Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
co = cohere.Client("E4YAyUyM0rKVUDlKULKmDK7JayiV8SmfDt4RnGKv")
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def chat_summarizer(conversation):
|
| 6 |
+
# generate summary using Cohere API
|
| 7 |
+
response = co.summarize(conversation, model='summarize-xlarge',length='short', extractiveness='high', temperature=0.5)
|
| 8 |
+
summary = response.summary
|
| 9 |
+
|
| 10 |
+
return summary
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
chat_input = gr.inputs.Textbox(lines=10, label="Conversation")
|
| 15 |
+
chat_output = gr.outputs.Textbox(label="Summary")
|
| 16 |
+
|
| 17 |
+
chat_interface = gr.Interface(fn=chat_summarizer, inputs=chat_input, outputs=chat_output,
|
| 18 |
+
title="Chat Summarizer", description="This app generates a summary of a chat conversation using Cohere API.")
|
| 19 |
+
|
| 20 |
+
chat_interface.launch(inline= False)
|