Spaces:
Sleeping
Sleeping
Update test.py
Browse files
test.py
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
-
client = InferenceClient("mounseflit/falcon-7b-marrakech-v2")
|
| 5 |
|
| 6 |
-
def predict(message, history):
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
|
| 14 |
-
with gr.Blocks() as demo:
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
|
| 21 |
-
demo.launch()
|
|
|
|
| 1 |
+
# import gradio as gr
|
| 2 |
+
# from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
+
# client = InferenceClient("mounseflit/falcon-7b-marrakech-v2")
|
| 5 |
|
| 6 |
+
# def predict(message, history):
|
| 7 |
+
# history = history or []
|
| 8 |
+
# history.append(message)
|
| 9 |
+
# response = client.text_generation(text=" ".join(history), max_length=200, do_sample=True, top_k=10, num_return_sequences=1, temperature=0.1)[0]['generated_text']
|
| 10 |
+
# history.append(response)
|
| 11 |
+
# response = response.replace(" ".join(history[:-1]), "")
|
| 12 |
+
# return response, history
|
| 13 |
|
| 14 |
+
# with gr.Blocks() as demo:
|
| 15 |
+
# chatbot = gr.Chatbot()
|
| 16 |
+
# message = gr.Textbox(placeholder="Enter your message here")
|
| 17 |
+
# state = gr.State()
|
| 18 |
+
# submit = gr.Button("SEND")
|
| 19 |
+
# submit.click(predict, inputs=[message, state], outputs=[chatbot, state])
|
| 20 |
|
| 21 |
+
# demo.launch()
|