aliabd HF Staff commited on
Commit
ddc6156
·
verified ·
1 Parent(s): 26c5278

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +1 -1
  2. requirements.txt +2 -2
  3. run.ipynb +1 -1
  4. run.py +11 -8
README.md CHANGED
@@ -5,7 +5,7 @@ emoji: 🔥
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
- sdk_version: 4.28.3
9
  app_file: run.py
10
  pinned: false
11
  hf_oauth: true
 
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
+ sdk_version: 4.31.2
9
  app_file: run.py
10
  pinned: false
11
  hf_oauth: true
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- gradio-client @ git+https://github.com/gradio-app/gradio@3a6f1a50b263e0a733f609a08019fc4d05480e1a#subdirectory=client/python
2
- https://gradio-builds.s3.amazonaws.com/3a6f1a50b263e0a733f609a08019fc4d05480e1a/gradio-4.28.3-py3-none-any.whl
 
1
+ gradio-client @ git+https://github.com/gradio-app/gradio@ee1e2942e0a1ae84a08a05464e41c8108a03fa9c#subdirectory=client/python
2
+ https://gradio-builds.s3.amazonaws.com/ee1e2942e0a1ae84a08a05464e41c8108a03fa9c/gradio-4.31.2-py3-none-any.whl
run.ipynb CHANGED
@@ -1 +1 @@
1
- {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: chatinterface_system_prompt"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import time\n", "\n", "def echo(message, history, system_prompt, tokens):\n", " response = f\"System prompt: {system_prompt}\\n Message: {message}.\"\n", " for i in range(min(len(response), int(tokens))):\n", " time.sleep(0.05)\n", " yield response[: i+1]\n", "\n", "demo = gr.ChatInterface(echo, \n", " additional_inputs=[\n", " gr.Textbox(\"You are helpful AI.\", label=\"System Prompt\"), \n", " gr.Slider(10, 100)\n", " ]\n", " )\n", "\n", "if __name__ == \"__main__\":\n", " demo.queue().launch()"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
 
1
+ {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: chatinterface_system_prompt"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import time\n", "\n", "\n", "def echo(message, history, system_prompt, tokens):\n", " response = f\"System prompt: {system_prompt}\\n Message: {message}.\"\n", " for i in range(min(len(response), int(tokens))):\n", " time.sleep(0.05)\n", " yield response[: i + 1]\n", "\n", "\n", "demo = gr.ChatInterface(\n", " echo,\n", " additional_inputs=[\n", " gr.Textbox(\"You are helpful AI.\", label=\"System Prompt\"),\n", " gr.Slider(10, 100),\n", " ],\n", ")\n", "\n", "if __name__ == \"__main__\":\n", " demo.queue().launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py CHANGED
@@ -1,18 +1,21 @@
1
  import gradio as gr
2
  import time
3
 
 
4
  def echo(message, history, system_prompt, tokens):
5
  response = f"System prompt: {system_prompt}\n Message: {message}."
6
  for i in range(min(len(response), int(tokens))):
7
  time.sleep(0.05)
8
- yield response[: i+1]
 
9
 
10
- demo = gr.ChatInterface(echo,
11
- additional_inputs=[
12
- gr.Textbox("You are helpful AI.", label="System Prompt"),
13
- gr.Slider(10, 100)
14
- ]
15
- )
 
16
 
17
  if __name__ == "__main__":
18
- demo.queue().launch()
 
1
  import gradio as gr
2
  import time
3
 
4
+
5
  def echo(message, history, system_prompt, tokens):
6
  response = f"System prompt: {system_prompt}\n Message: {message}."
7
  for i in range(min(len(response), int(tokens))):
8
  time.sleep(0.05)
9
+ yield response[: i + 1]
10
+
11
 
12
+ demo = gr.ChatInterface(
13
+ echo,
14
+ additional_inputs=[
15
+ gr.Textbox("You are helpful AI.", label="System Prompt"),
16
+ gr.Slider(10, 100),
17
+ ],
18
+ )
19
 
20
  if __name__ == "__main__":
21
+ demo.queue().launch()