Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,17 +72,17 @@ class ChatRequest(BaseModel):
|
|
| 72 |
message: str
|
| 73 |
history: list = []
|
| 74 |
|
| 75 |
-
|
|
|
|
| 76 |
def chat_endpoint(request: ChatRequest):
|
| 77 |
output = ""
|
|
|
|
| 78 |
prompt = f"<|im_start|>system\n{SYSTEM_PROMPT}<|im_end|>\n"
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
output += token["choices"][0]["text"]
|
| 85 |
-
return {"response": output}
|
| 86 |
|
| 87 |
# ----------------------------
|
| 88 |
# Gradio UI
|
|
|
|
| 72 |
message: str
|
| 73 |
history: list = []
|
| 74 |
|
| 75 |
+
# FastAPI endpoint ko simple banayein taaki Web Search client connect kar sake
|
| 76 |
+
@app.post("/generate_response") # Path ko match karne ke liye change kiya
|
| 77 |
def chat_endpoint(request: ChatRequest):
|
| 78 |
output = ""
|
| 79 |
+
# Prompt logic (Same as yours)
|
| 80 |
prompt = f"<|im_start|>system\n{SYSTEM_PROMPT}<|im_end|>\n"
|
| 81 |
+
# ... baki prompt logic ...
|
| 82 |
+
|
| 83 |
+
# Streaming off rakhein API response ke liye taaki ek baar mein pura text mile
|
| 84 |
+
res = llm(prompt, max_tokens=1024, temperature=0.3)
|
| 85 |
+
return res["choices"][0]["text"]
|
|
|
|
|
|
|
| 86 |
|
| 87 |
# ----------------------------
|
| 88 |
# Gradio UI
|