Spaces:
Runtime error
Runtime error
LysandreJik
commited on
Commit
•
60cd313
1
Parent(s):
f0267c9
Initial commit
Browse files- app.py +68 -0
- requirements.txt +1 -0
app.py
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
default_question = """
|
4 |
+
We're going to use the <a href="https://huggingface.co/datasets/wikitext"><code>wikitext (link)</a></code> dataset with the <code><a href="https://huggingface.co/bert-base-cased?">bert-base-cased (link)</a></code> model checkpoint.
|
5 |
+
|
6 |
+
<br/><br/>
|
7 |
+
|
8 |
+
Start by loading the <code>wikitext-2-raw-v1</code> version of that dataset, and take the 11th example (index 10) of the <code>train</code> split.<br/>
|
9 |
+
We'll tokenize this using the appropriate tokenizer, and we'll mask the sixth token (index 5) the sequence.
|
10 |
+
|
11 |
+
<br/><br/>
|
12 |
+
|
13 |
+
When using the <code>bert-base-cased</code> checkpoint to unmask that token, what is the most probable prediction?
|
14 |
+
"""
|
15 |
+
|
16 |
+
internships = {
|
17 |
+
'Accelerate': default_question,
|
18 |
+
'Diffusion distillation': default_question,
|
19 |
+
'Skops & Scikit-Learn': default_question,
|
20 |
+
"Code Generation": default_question,
|
21 |
+
"Document AI Democratization": default_question,
|
22 |
+
"Evaluate": default_question,
|
23 |
+
"ASR": default_question,
|
24 |
+
"Efficient video pretraining": default_question,
|
25 |
+
"Embodied AI": default_question,
|
26 |
+
"Emergence of scene and text understanding": default_question,
|
27 |
+
"Everything is multimodal": default_question,
|
28 |
+
"Everything is vision": default_question,
|
29 |
+
"Retrieval augmentation as prompting": default_question,
|
30 |
+
"Social impact evaluations": default_question,
|
31 |
+
"Toolkit for detecting distribution shift": default_question,
|
32 |
+
"AI Art Tooling Residency": default_question,
|
33 |
+
"Gradio as an ecosystem": default_question,
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
with gr.Blocks() as demo:
|
38 |
+
gr.Markdown(
|
39 |
+
"""
|
40 |
+
# Internship introduction
|
41 |
+
Please select the internship you would like to apply to and answer the question asked in the Answer box.
|
42 |
+
"""
|
43 |
+
)
|
44 |
+
|
45 |
+
internship_choice = gr.Dropdown(label='Internship', choices=list(internships.keys()))
|
46 |
+
|
47 |
+
with gr.Column(visible=False) as details_col:
|
48 |
+
summary = gr.HTML(label='Question')
|
49 |
+
details = gr.Textbox(label="Answer")
|
50 |
+
username = gr.Textbox(label="Hugging Face Username")
|
51 |
+
generate_btn = gr.Button("Submit")
|
52 |
+
output = gr.Label()
|
53 |
+
|
54 |
+
def filter_species(species):
|
55 |
+
return gr.Label.update(
|
56 |
+
internships[species]
|
57 |
+
), gr.update(visible=True)
|
58 |
+
|
59 |
+
internship_choice.change(filter_species, internship_choice, [summary, details_col])
|
60 |
+
|
61 |
+
def on_click(_details, _username):
|
62 |
+
return f"Submitted: '{_details}' for user '{_username}'"
|
63 |
+
|
64 |
+
generate_btn.click(on_click, inputs=[details, username], outputs=[output])
|
65 |
+
|
66 |
+
|
67 |
+
if __name__ == "__main__":
|
68 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
gradio
|