Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,77 +17,75 @@ with gr.Blocks() as demo:
|
|
| 17 |
with gr.Column(scale = 1):
|
| 18 |
useapi = gr.Button("Use this API key")
|
| 19 |
with gr.Row(visible = False) as fullblock:
|
| 20 |
-
with gr.
|
| 21 |
-
with gr.
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
with gr.
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
with gr.
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
with gr.
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
with gr.Row():
|
| 84 |
-
clear = gr.Button("Clear")
|
| 85 |
|
| 86 |
def checkapiinput(apikey):
|
| 87 |
if apikey != "" and apikey is not None and len(apikey) >=25 and len(apikey) <= 130:
|
| 88 |
-
return gr.update(visible=True), gr.update(visible=False), gr.update(visible=True)
|
| 89 |
else:
|
| 90 |
-
return gr.update(visible=False), gr.update(visible=True), gr.update(value="", placeholder="Use a valid API key")
|
| 91 |
|
| 92 |
def parse_participants(input_string: str) -> list:
|
| 93 |
# Replace <br> tags with newline characters
|
|
@@ -362,7 +360,7 @@ Now please provide your results.
|
|
| 362 |
generategroup.click(generateprofiles, [title, question1, question2, question3, focusgroupdescription], [expert1, expert2, expert3, expert4, expert5, expert6, expert7, expert8, expert9, expert10])
|
| 363 |
generateresults.click(generateanswers, [title, question1, question2, question3, expert1, expert2, expert3, expert4, expert5, expert6, expert7, expert8, expert9, expert10], [response1, response2, response3, response4, response5, response6, response7, response8, response9, response10])
|
| 364 |
generatesummary.click(summarize, [title, question1, question2, question3, expert1, expert2, expert3, expert4, expert5, expert6, expert7, expert8, expert9, expert10, response1, response2, response3, response4, response5, response6, response7, response8, response9, response10], summary)
|
| 365 |
-
useapi.click(checkapiinput, apikey, [fullblock, apicheck, apikey])
|
| 366 |
clear.click(init_history, title, [title, question1, question2, question3, focusgroupdescription, expert1, expert2, expert3, expert4, expert5, expert6, expert7, expert8, expert9, expert10, response1, response2, response3, response4, response5, response6, response7, response8, response9, response10, summary])
|
| 367 |
|
| 368 |
demo.launch()
|
|
|
|
| 17 |
with gr.Column(scale = 1):
|
| 18 |
useapi = gr.Button("Use this API key")
|
| 19 |
with gr.Row(visible = False) as fullblock:
|
| 20 |
+
with gr.Tab("Enquiry Description"):
|
| 21 |
+
with gr.Row():
|
| 22 |
+
gr.Markdown("Describe your project or study")
|
| 23 |
+
with gr.Row():
|
| 24 |
+
title = gr.Textbox(label='Topic you would like to submit to your focus group', lines = 5)
|
| 25 |
+
with gr.Row():
|
| 26 |
+
gr.Markdown("List all your questions")
|
| 27 |
+
with gr.Row():
|
| 28 |
+
question1 = gr.Textbox(label="Question 1", lines=2)
|
| 29 |
+
with gr.Row():
|
| 30 |
+
question2 = gr.Textbox(label="Question 2", lines=2)
|
| 31 |
+
with gr.Row():
|
| 32 |
+
question3 = gr.Textbox(label="Question 3", lines=2)
|
| 33 |
+
with gr.Tab("Focus Group Profiles Generation"):
|
| 34 |
+
with gr.Row():
|
| 35 |
+
gr.Markdown("Describe types of profiles you want in your focus group")
|
| 36 |
+
with gr.Row():
|
| 37 |
+
focusgroupdescription = gr.Textbox(label="Describe your focus group desired characteristics", info= "For example: women in their 30s, teenagers, mixed ethnicity from Vietnam, ...", lines=5)
|
| 38 |
+
with gr.Row():
|
| 39 |
+
generategroup = gr.Button("Generate my focus group")
|
| 40 |
+
with gr.Row():
|
| 41 |
+
gr.Markdown("Participants")
|
| 42 |
+
with gr.Row():
|
| 43 |
+
expert1 = gr.Textbox(label="Participant 1", lines=5)
|
| 44 |
+
expert2 = gr.Textbox(label="Participant 2", lines=5)
|
| 45 |
+
with gr.Row():
|
| 46 |
+
expert3 = gr.Textbox(label="Participant 3", lines=5)
|
| 47 |
+
expert4 = gr.Textbox(label="Participant 4", lines=5)
|
| 48 |
+
with gr.Row():
|
| 49 |
+
expert5 = gr.Textbox(label="Participant 5", lines=5)
|
| 50 |
+
expert6 = gr.Textbox(label="Participant 6", lines=5)
|
| 51 |
+
with gr.Row():
|
| 52 |
+
expert7 = gr.Textbox(label="Participant 7", lines=5)
|
| 53 |
+
expert8 = gr.Textbox(label="Participant 8", lines=5)
|
| 54 |
+
with gr.Row():
|
| 55 |
+
expert9 = gr.Textbox(label="Participant 9", lines=5)
|
| 56 |
+
expert10 = gr.Textbox(label="Participant 10", lines=5)
|
| 57 |
+
with gr.Tab("Results"):
|
| 58 |
+
with gr.Row():
|
| 59 |
+
generateresults = gr.Button("Generate focus group answers")
|
| 60 |
+
with gr.Row():
|
| 61 |
+
gr.Markdown("Responses from the focus group participants")
|
| 62 |
+
with gr.Row():
|
| 63 |
+
response1 = gr.Textbox(label="Response 1", lines=10)
|
| 64 |
+
response2 = gr.Textbox(label="Response 2", lines=10)
|
| 65 |
+
with gr.Row():
|
| 66 |
+
response3 = gr.Textbox(label="Response 3", lines=10)
|
| 67 |
+
response4 = gr.Textbox(label="Response 4", lines=10)
|
| 68 |
+
with gr.Row():
|
| 69 |
+
response5 = gr.Textbox(label="Response 5", lines=10)
|
| 70 |
+
response6 = gr.Textbox(label="Response 6", lines=10)
|
| 71 |
+
with gr.Row():
|
| 72 |
+
response7 = gr.Textbox(label="Response 7", lines=10)
|
| 73 |
+
response8 = gr.Textbox(label="Response 8", lines=10)
|
| 74 |
+
with gr.Row():
|
| 75 |
+
response9 = gr.Textbox(label="Response 9", lines=10)
|
| 76 |
+
response10 = gr.Textbox(label="Response 10", lines=10)
|
| 77 |
+
with gr.Tab("Summary"):
|
| 78 |
+
with gr.Row():
|
| 79 |
+
generatesummary = gr.Button("Generate the focus group summary")
|
| 80 |
+
with gr.Row():
|
| 81 |
+
summary = gr.Textbox(label="Report summary", lines=50)
|
| 82 |
+
clear = gr.Button("Clear", visible = False)
|
|
|
|
|
|
|
| 83 |
|
| 84 |
def checkapiinput(apikey):
|
| 85 |
if apikey != "" and apikey is not None and len(apikey) >=25 and len(apikey) <= 130:
|
| 86 |
+
return gr.update(visible=True), gr.update(visible=False), gr.update(visible=True), gr.update(visible=True)
|
| 87 |
else:
|
| 88 |
+
return gr.update(visible=False), gr.update(visible=True), gr.update(value="", placeholder="Use a valid API key"), gr.update(visible=False)
|
| 89 |
|
| 90 |
def parse_participants(input_string: str) -> list:
|
| 91 |
# Replace <br> tags with newline characters
|
|
|
|
| 360 |
generategroup.click(generateprofiles, [title, question1, question2, question3, focusgroupdescription], [expert1, expert2, expert3, expert4, expert5, expert6, expert7, expert8, expert9, expert10])
|
| 361 |
generateresults.click(generateanswers, [title, question1, question2, question3, expert1, expert2, expert3, expert4, expert5, expert6, expert7, expert8, expert9, expert10], [response1, response2, response3, response4, response5, response6, response7, response8, response9, response10])
|
| 362 |
generatesummary.click(summarize, [title, question1, question2, question3, expert1, expert2, expert3, expert4, expert5, expert6, expert7, expert8, expert9, expert10, response1, response2, response3, response4, response5, response6, response7, response8, response9, response10], summary)
|
| 363 |
+
useapi.click(checkapiinput, apikey, [fullblock, apicheck, apikey, clear])
|
| 364 |
clear.click(init_history, title, [title, question1, question2, question3, focusgroupdescription, expert1, expert2, expert3, expert4, expert5, expert6, expert7, expert8, expert9, expert10, response1, response2, response3, response4, response5, response6, response7, response8, response9, response10, summary])
|
| 365 |
|
| 366 |
demo.launch()
|