Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
|
@@ -69,8 +69,8 @@ def respond(
|
|
| 69 |
if 'choices' in json_response and len(json_response['choices']) > 0:
|
| 70 |
content = json_response['choices'][0].get('message', {}).get('content', '')
|
| 71 |
if content:
|
| 72 |
-
|
| 73 |
-
|
| 74 |
print(f"[INFO] response: {content}")
|
| 75 |
return content
|
| 76 |
return "Service temporarily unavailable"
|
|
@@ -86,7 +86,6 @@ demo = gr.ChatInterface(
|
|
| 86 |
respond,
|
| 87 |
additional_inputs=[
|
| 88 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
| 89 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 90 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.6, step=0.1, label="Temperature"),
|
| 91 |
gr.Slider(
|
| 92 |
minimum=0.1,
|
|
@@ -100,4 +99,4 @@ demo = gr.ChatInterface(
|
|
| 100 |
|
| 101 |
|
| 102 |
if __name__ == "__main__":
|
| 103 |
-
demo.launch()
|
|
|
|
| 69 |
if 'choices' in json_response and len(json_response['choices']) > 0:
|
| 70 |
content = json_response['choices'][0].get('message', {}).get('content', '')
|
| 71 |
if content:
|
| 72 |
+
if '<think>' in content and '</think>' in content:
|
| 73 |
+
content = content.split('</think>')[-1].strip()
|
| 74 |
print(f"[INFO] response: {content}")
|
| 75 |
return content
|
| 76 |
return "Service temporarily unavailable"
|
|
|
|
| 86 |
respond,
|
| 87 |
additional_inputs=[
|
| 88 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
|
|
|
| 89 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.6, step=0.1, label="Temperature"),
|
| 90 |
gr.Slider(
|
| 91 |
minimum=0.1,
|
|
|
|
| 99 |
|
| 100 |
|
| 101 |
if __name__ == "__main__":
|
| 102 |
+
demo.launch(share=True)
|