diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7f079ce --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/ollama +/venv diff --git a/app.py b/app.py new file mode 100644 index 0000000..00a842d --- /dev/null +++ b/app.py @@ -0,0 +1,22 @@ +import requests +import gradio as gr + +def ask(text): + url = "http://localhost:7869/ " + payload = {"text": text} + response = requests.post(url, json=payload) + + if response.status_code == 200: + return response.json().get("response", "No response from API") + else: + return f"Error: {response.status_code}" + +with gr.Blocks() as server: + with gr.Tab("LLM Inferencing"): + input_text = gr.Textbox(label="Input Text", placeholder="Enter your text here...") + output_text = gr.Textbox(label="Output Text") + submit_button = gr.Button("Submit") + + submit_button.click(fn=ask, inputs=input_text, outputs=output_text) + +server.launch() \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6217ed2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +services: + ollama: + image: ollama/ollama:latest + ports: + - 7869:11434 + volumes: + - .:/code + - ./ollama/ollama:/root/.ollama + container_name: ollama + pull_policy: always + tty: true + restart: always + environment: + - OLLAMA_KEEP_ALIVE=24h + - OLLAMA_HOST=0.0.0.0 \ No newline at end of file