add intital project files
This commit is contained in:
parent
ca8dcd9e38
commit
b1fef94783
3 changed files with 39 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
/ollama
|
||||||
|
/venv
|
22
app.py
Normal file
22
app.py
Normal file
|
@ -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()
|
15
docker-compose.yml
Normal file
15
docker-compose.yml
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue