Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,17 +18,21 @@ model = SentenceTransformer(sentence_similarity_model)
|
|
| 18 |
# Loading in text-generation models
|
| 19 |
stoic_generator = pipeline("text-generation", model="eliwill/stoic-generator-10e")
|
| 20 |
krishnamurti_generator = pipeline("text-generation", model="eliwill/distilgpt2-finetuned-final-project")
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Creating philosopher dictionary
|
| 23 |
philosopher_dictionary = {
|
| 24 |
"Marcus Aurelius": {
|
| 25 |
"generator": stoic_generator,
|
| 26 |
-
"dataframe": stoic_df
|
|
|
|
| 27 |
},
|
| 28 |
|
| 29 |
"Krishnamurti": {
|
| 30 |
"generator": krishnamurti_generator,
|
| 31 |
-
"dataframe": krishnamurti_df
|
|
|
|
| 32 |
}
|
| 33 |
}
|
| 34 |
|
|
@@ -54,7 +58,7 @@ def get_similar_quotes(philosopher, question):
|
|
| 54 |
return top5quotes
|
| 55 |
|
| 56 |
def main(question, philosopher):
|
| 57 |
-
out_image =
|
| 58 |
return ask_philosopher(philosopher, question), get_similar_quotes(philosopher, question), out_image
|
| 59 |
|
| 60 |
with gr.Blocks(css=".gradio-container {background-image: url('file=blue_mountains.jpg')} # title {color: #F0FFFF}") as demo:
|
|
@@ -67,7 +71,7 @@ with gr.Blocks(css=".gradio-container {background-image: url('file=blue_mountain
|
|
| 67 |
with gr.Row():
|
| 68 |
with gr.Column():
|
| 69 |
inp1 = gr.Textbox(placeholder="Place your question here...", label="Ask a question", elem_id="title")
|
| 70 |
-
inp2 = gr.Dropdown(choices=["Marcus Aurelius", "Krishnamurti"], value="Marcus Aurelius", label="Choose a philosopher")
|
| 71 |
|
| 72 |
out1 = gr.Textbox(
|
| 73 |
lines=3,
|
|
|
|
| 18 |
# Loading in text-generation models
|
| 19 |
stoic_generator = pipeline("text-generation", model="eliwill/stoic-generator-10e")
|
| 20 |
krishnamurti_generator = pipeline("text-generation", model="eliwill/distilgpt2-finetuned-final-project")
|
| 21 |
+
alan_generator = pipeline("text-generation", model="eliwill/alan-watts-8e")
|
| 22 |
+
|
| 23 |
|
| 24 |
# Creating philosopher dictionary
|
| 25 |
philosopher_dictionary = {
|
| 26 |
"Marcus Aurelius": {
|
| 27 |
"generator": stoic_generator,
|
| 28 |
+
"dataframe": stoic_df,
|
| 29 |
+
"image": "marcus-aurelius.jpg"
|
| 30 |
},
|
| 31 |
|
| 32 |
"Krishnamurti": {
|
| 33 |
"generator": krishnamurti_generator,
|
| 34 |
+
"dataframe": krishnamurti_df,
|
| 35 |
+
"image": "krishnamurti.jpg"
|
| 36 |
}
|
| 37 |
}
|
| 38 |
|
|
|
|
| 58 |
return top5quotes
|
| 59 |
|
| 60 |
def main(question, philosopher):
|
| 61 |
+
out_image = philosopher_dictionary[philosopher]['image']
|
| 62 |
return ask_philosopher(philosopher, question), get_similar_quotes(philosopher, question), out_image
|
| 63 |
|
| 64 |
with gr.Blocks(css=".gradio-container {background-image: url('file=blue_mountains.jpg')} # title {color: #F0FFFF}") as demo:
|
|
|
|
| 71 |
with gr.Row():
|
| 72 |
with gr.Column():
|
| 73 |
inp1 = gr.Textbox(placeholder="Place your question here...", label="Ask a question", elem_id="title")
|
| 74 |
+
inp2 = gr.Dropdown(choices=["Marcus Aurelius", "Krishnamurti", "Alan Watts"], value="Marcus Aurelius", label="Choose a philosopher")
|
| 75 |
|
| 76 |
out1 = gr.Textbox(
|
| 77 |
lines=3,
|