Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ from starlette.responses import StreamingResponse, JSONResponse
|
|
| 10 |
"""
|
| 11 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 12 |
"""
|
| 13 |
-
client = InferenceClient("
|
| 14 |
|
| 15 |
|
| 16 |
def respond(
|
|
@@ -76,7 +76,7 @@ def chat_get(message: str = "", system_message: str = "You are a friendly Chatbo
|
|
| 76 |
predict_response = requests.post('http://localhost:7860/call/chat', json={'data': [message, system_message, max_tokens, temperature, top_p]}).json()
|
| 77 |
if "event_id" not in predict_response:
|
| 78 |
return predict_response
|
| 79 |
-
return JSONResponse(json.loads(requests.get(f'http://localhost:7860/call/chat/{predict_response["event_id"]}').text.split("data: ", 1)[-1]))
|
| 80 |
|
| 81 |
if __name__ == "__main__":
|
| 82 |
app = gr.mount_gradio_app(app, demo, path="/")
|
|
|
|
| 10 |
"""
|
| 11 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 12 |
"""
|
| 13 |
+
client = InferenceClient("microsoft/Phi-3-mini-4k-instruct")
|
| 14 |
|
| 15 |
|
| 16 |
def respond(
|
|
|
|
| 76 |
predict_response = requests.post('http://localhost:7860/call/chat', json={'data': [message, system_message, max_tokens, temperature, top_p]}).json()
|
| 77 |
if "event_id" not in predict_response:
|
| 78 |
return predict_response
|
| 79 |
+
return JSONResponse(json.loads(requests.get(f'http://localhost:7860/call/chat/{predict_response["event_id"]}').text.rsplit("\n\nevent: error", 1)[0].split("data: ", 1)[-1]))
|
| 80 |
|
| 81 |
if __name__ == "__main__":
|
| 82 |
app = gr.mount_gradio_app(app, demo, path="/")
|