Washedashore commited on
Commit
20e9eb9
·
verified ·
1 Parent(s): 42f772b

import gradio as gr
import time


def echo(message, history, system_prompt, tokens):
response = f"System prompt: {system_prompt}\n Message: {message}."
for i in range(min(len(response), int(tokens))):
time.sleep(0.05)
yield response[: i + 1]


demo = gr.ChatInterface(
echo,
additional_inputs=[
gr.Textbox("You are helpful AI.", label="System Prompt"),
gr.Slider(10, 100),
],
)

if __name__ == "__main__":
demo.queue().launch()

Files changed (1) hide show
  1. README.md +7 -4
README.md CHANGED
@@ -1,13 +1,16 @@
1
  ---
2
  title: Grad
3
- emoji: 💬
4
- colorFrom: yellow
5
- colorTo: purple
6
  sdk: gradio
7
- sdk_version: 4.36.1
8
  app_file: app.py
9
  pinned: false
10
  license: cc-by-nc-sa-4.0
 
 
 
11
  ---
12
 
13
  An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
 
1
  ---
2
  title: Grad
3
+ emoji: 🏆
4
+ colorFrom: blue
5
+ colorTo: yellow
6
  sdk: gradio
7
+ sdk_version: 4.38.1
8
  app_file: app.py
9
  pinned: false
10
  license: cc-by-nc-sa-4.0
11
+ thumbnail: >-
12
+ https://cdn-uploads.huggingface.co/production/uploads/66912f455b5388424c818323/cHWN5M18U_NBpvwVUL8GO.png
13
+ short_description: moded chatbot with grad
14
  ---
15
 
16
  An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).