Spaces:
Running
Running
mateoluksenberg
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -209,7 +209,7 @@ EXAMPLES = [
|
|
209 |
# Definir la estructura del mensaje utilizando Pydantic
|
210 |
class Message(BaseModel):
|
211 |
text: str
|
212 |
-
file: Optional[UploadFile] = None
|
213 |
|
214 |
# Definir la función simple_chat
|
215 |
def simple_chat(message: Message, temperature: float = 0.8, max_length: int = 4096, top_p: float = 1, top_k: int = 10, penalty: float = 1.0):
|
@@ -274,6 +274,14 @@ def simple_chat(message: Message, temperature: float = 0.8, max_length: int = 40
|
|
274 |
async def chat(message: Message):
|
275 |
return simple_chat(message)
|
276 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
with gr.Blocks(css=CSS, theme="soft", fill_height=True) as demo:
|
278 |
gr.HTML(TITLE)
|
279 |
gr.HTML(DESCRIPTION)
|
|
|
209 |
# Definir la estructura del mensaje utilizando Pydantic
|
210 |
class Message(BaseModel):
|
211 |
text: str
|
212 |
+
#file: Optional[UploadFile] = None
|
213 |
|
214 |
# Definir la función simple_chat
|
215 |
def simple_chat(message: Message, temperature: float = 0.8, max_length: int = 4096, top_p: float = 1, top_k: int = 10, penalty: float = 1.0):
|
|
|
274 |
async def chat(message: Message):
|
275 |
return simple_chat(message)
|
276 |
|
277 |
+
@app.post("/chat/")
|
278 |
+
async def test_endpoint(message: dict):
|
279 |
+
if "text" not in message:
|
280 |
+
raise HTTPException(status_code=400, detail="Missing 'text' in request body")
|
281 |
+
|
282 |
+
response = {"message": f"Received your message: {message['text']}"}
|
283 |
+
return simple_chat(message)
|
284 |
+
|
285 |
with gr.Blocks(css=CSS, theme="soft", fill_height=True) as demo:
|
286 |
gr.HTML(TITLE)
|
287 |
gr.HTML(DESCRIPTION)
|