Spaces:
Running
Running
Tu Nombre
commited on
Commit
·
d5e886a
1
Parent(s):
62ad6d3
Improve UI and error handling
Browse files
app.py
CHANGED
@@ -35,7 +35,7 @@ class QueryRequest(BaseModel):
|
|
35 |
|
36 |
class QueryResponse(BaseModel):
|
37 |
response: str
|
38 |
-
model: str = "llama3-papalia
|
39 |
|
40 |
OLLAMA_API_URL = "http://localhost:11434/api/generate"
|
41 |
OLLAMA_BASE_URL = "http://localhost:11434"
|
@@ -51,7 +51,7 @@ async def check_ollama_status() -> Dict[str, Any]:
|
|
51 |
model_response = await client.post(
|
52 |
OLLAMA_BASE_URL + "/api/generate",
|
53 |
json={
|
54 |
-
"model": "llama3-papalia
|
55 |
"prompt": "test",
|
56 |
"max_tokens": 1
|
57 |
},
|
@@ -93,7 +93,7 @@ async def generate_response(query: QueryRequest):
|
|
93 |
response = await client.post(
|
94 |
OLLAMA_API_URL,
|
95 |
json={
|
96 |
-
"model": "llama3-papalia
|
97 |
"prompt": query.prompt,
|
98 |
"stream": False,
|
99 |
"temperature": query.temperature,
|
@@ -110,7 +110,7 @@ async def generate_response(query: QueryRequest):
|
|
110 |
|
111 |
result = response.json()
|
112 |
logger.info("Respuesta generada exitosamente")
|
113 |
-
return {"response": result.get("response", ""), "model": "llama3-papalia
|
114 |
|
115 |
except httpx.TimeoutException:
|
116 |
logger.error("Timeout en la solicitud a Ollama")
|
|
|
35 |
|
36 |
class QueryResponse(BaseModel):
|
37 |
response: str
|
38 |
+
model: str = "llama3.2:1b-papalia"
|
39 |
|
40 |
OLLAMA_API_URL = "http://localhost:11434/api/generate"
|
41 |
OLLAMA_BASE_URL = "http://localhost:11434"
|
|
|
51 |
model_response = await client.post(
|
52 |
OLLAMA_BASE_URL + "/api/generate",
|
53 |
json={
|
54 |
+
"model": "llama3.2:1b-papalia",
|
55 |
"prompt": "test",
|
56 |
"max_tokens": 1
|
57 |
},
|
|
|
93 |
response = await client.post(
|
94 |
OLLAMA_API_URL,
|
95 |
json={
|
96 |
+
"model": "llama3.2:1b-papalia",
|
97 |
"prompt": query.prompt,
|
98 |
"stream": False,
|
99 |
"temperature": query.temperature,
|
|
|
110 |
|
111 |
result = response.json()
|
112 |
logger.info("Respuesta generada exitosamente")
|
113 |
+
return {"response": result.get("response", ""), "model": "llama3.2:1b-papalia"}
|
114 |
|
115 |
except httpx.TimeoutException:
|
116 |
logger.error("Timeout en la solicitud a Ollama")
|