Update app.py
Browse files
app.py
CHANGED
@@ -3,9 +3,6 @@ import gradio as gr
|
|
3 |
from PIL import Image
|
4 |
import os
|
5 |
|
6 |
-
import time
|
7 |
-
import tqdm
|
8 |
-
|
9 |
import openai
|
10 |
|
11 |
#api_key = os.environ.get('api_key')
|
@@ -105,6 +102,20 @@ title = """
|
|
105 |
</div>
|
106 |
"""
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
with gr.Blocks(css="style.css") as demo:
|
109 |
|
110 |
with gr.Column(elem_id="col-container"):
|
@@ -130,7 +141,9 @@ with gr.Blocks(css="style.css") as demo:
|
|
130 |
openai_api_key = gr.Textbox(max_lines=1, type="password", label="π Your OpenAI API Key", placeholder="sk-123abc...")
|
131 |
|
132 |
|
133 |
-
|
|
|
|
|
134 |
|
135 |
clean_btn.click(clean_components, inputs=[], outputs=[record_input, error_handler, whisper_tr, gpt_response, clean_btn])
|
136 |
send_btn.click(infer, inputs=[record_input, openai_api_key], outputs=[whisper_tr, gpt_response, error_handler, share_group, clean_btn])
|
|
|
3 |
from PIL import Image
|
4 |
import os
|
5 |
|
|
|
|
|
|
|
6 |
import openai
|
7 |
|
8 |
#api_key = os.environ.get('api_key')
|
|
|
102 |
</div>
|
103 |
"""
|
104 |
|
105 |
+
article = """
|
106 |
+
<p style="font-size: 0.8em;line-height: 1.2em;">Note: this demo is not able to sustain a conversation from earlier responses.
|
107 |
+
For more detailed results and dialogue, you should use the official ChatGPT interface.
|
108 |
+
<br />β
|
109 |
+
<br/>Also, be aware that audio records from iOS devices will not be decoded as expected by Gradio. For the best experience, record your voice from a computer instead of your smartphone ;)</p>
|
110 |
+
<div class="footer">
|
111 |
+
<p>Whisper &
|
112 |
+
<a href="https://chat.openai.com/chat" target="_blank">chatGPT</a>
|
113 |
+
by <a href="https://openai.com/" style="text-decoration: underline;" target="_blank">OpenAI</a> -
|
114 |
+
Gradio Demo by π€ <a href="https://twitter.com/fffiloni" target="_blank">Sylvain Filoni</a>
|
115 |
+
</p>
|
116 |
+
</div>
|
117 |
+
"""
|
118 |
+
|
119 |
with gr.Blocks(css="style.css") as demo:
|
120 |
|
121 |
with gr.Column(elem_id="col-container"):
|
|
|
141 |
openai_api_key = gr.Textbox(max_lines=1, type="password", label="π Your OpenAI API Key", placeholder="sk-123abc...")
|
142 |
|
143 |
|
144 |
+
send_btn = gr.Button("Send my request !")
|
145 |
+
|
146 |
+
gr.HTML(article)
|
147 |
|
148 |
clean_btn.click(clean_components, inputs=[], outputs=[record_input, error_handler, whisper_tr, gpt_response, clean_btn])
|
149 |
send_btn.click(infer, inputs=[record_input, openai_api_key], outputs=[whisper_tr, gpt_response, error_handler, share_group, clean_btn])
|