Spaces:
Running
Running
Richard Fan
commited on
Commit
·
96e5bc9
1
Parent(s):
3c0c20a
update app
Browse files- readme_images/hf_example.png +0 -0
- src/app.py +5 -4
readme_images/hf_example.png
CHANGED
![]() |
![]() |
src/app.py
CHANGED
@@ -150,7 +150,6 @@ def test(email, topic, physics_topic, categories, interest, key):
|
|
150 |
|
151 |
|
152 |
def register_openai_token(token):
|
153 |
-
print(f"registering new key: {token[:5]}")
|
154 |
openai.api_key = token
|
155 |
|
156 |
with gr.Blocks() as demo:
|
@@ -159,7 +158,7 @@ with gr.Blocks() as demo:
|
|
159 |
with gr.Box():
|
160 |
token = gr.Textbox(label="OpenAI API Key", type="password")
|
161 |
with gr.Box():
|
162 |
-
description = gr.HTML(value="Send an email to the below address using the configuration on the right. Requires a sendgrid token")
|
163 |
email = gr.Textbox(label="Email address", type="email", placeholder="")
|
164 |
sendgrid_token = gr.Textbox(label="SendGrid API Key", type="password")
|
165 |
with gr.Row():
|
@@ -176,10 +175,12 @@ with gr.Blocks() as demo:
|
|
176 |
subject.change(fn=change_subsubject, inputs=[subject, physics_subject], outputs=subsubject)
|
177 |
physics_subject.change(fn=change_subsubject, inputs=[subject, physics_subject], outputs=subsubject)
|
178 |
|
179 |
-
interest = gr.Textbox(label="A natural language description of what you are interested in. Press shift-enter to update.", lines=7)
|
180 |
-
|
|
|
181 |
test_btn.click(fn=test, inputs=[email, subject, physics_subject, subsubject, interest, sendgrid_token], outputs=output)
|
182 |
token.change(fn=register_openai_token, inputs=[token])
|
|
|
183 |
subject.change(fn=sample, inputs=[email, subject, physics_subject, subsubject, interest], outputs=sample_output)
|
184 |
physics_subject.change(fn=sample, inputs=[email, subject, physics_subject, subsubject, interest], outputs=sample_output)
|
185 |
subsubject.change(fn=sample, inputs=[email, subject, physics_subject, subsubject, interest], outputs=sample_output)
|
|
|
150 |
|
151 |
|
152 |
def register_openai_token(token):
|
|
|
153 |
openai.api_key = token
|
154 |
|
155 |
with gr.Blocks() as demo:
|
|
|
158 |
with gr.Box():
|
159 |
token = gr.Textbox(label="OpenAI API Key", type="password")
|
160 |
with gr.Box():
|
161 |
+
description = gr.HTML(value="Send an email to the below address using the configuration on the right. Requires a sendgrid token. These values are not needed to use the right side of this page.\n\n")
|
162 |
email = gr.Textbox(label="Email address", type="email", placeholder="")
|
163 |
sendgrid_token = gr.Textbox(label="SendGrid API Key", type="password")
|
164 |
with gr.Row():
|
|
|
175 |
subject.change(fn=change_subsubject, inputs=[subject, physics_subject], outputs=subsubject)
|
176 |
physics_subject.change(fn=change_subsubject, inputs=[subject, physics_subject], outputs=subsubject)
|
177 |
|
178 |
+
interest = gr.Textbox(label="A natural language description of what you are interested in. Press shift-enter or click the button below to update.", lines=7)
|
179 |
+
sample_btn = gr.Button("Generate Digest")
|
180 |
+
sample_output = gr.Textbox(label="Results for your configuration")
|
181 |
test_btn.click(fn=test, inputs=[email, subject, physics_subject, subsubject, interest, sendgrid_token], outputs=output)
|
182 |
token.change(fn=register_openai_token, inputs=[token])
|
183 |
+
sample_btn.click(fn=sample, inputs=[email, subject, physics_subject, subsubject, interest], outputs=sample_output)
|
184 |
subject.change(fn=sample, inputs=[email, subject, physics_subject, subsubject, interest], outputs=sample_output)
|
185 |
physics_subject.change(fn=sample, inputs=[email, subject, physics_subject, subsubject, interest], outputs=sample_output)
|
186 |
subsubject.change(fn=sample, inputs=[email, subject, physics_subject, subsubject, interest], outputs=sample_output)
|