carlosrosash commited on
Commit
49385f2
1 Parent(s): ba64a0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -7
app.py CHANGED
@@ -100,7 +100,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus elementum leo a
100
  Ut ac volutpat nisi.
101
  </p>
102
  """
103
-
104
  list_dropdown = [
105
  'Proust',
106
  'Encyclopédie',
@@ -133,7 +132,6 @@ list_dropdown = [
133
  'Baudrillard',
134
  'Romans contemporains'
135
  ]
136
-
137
  # Dictionary of explanations for each artist or style
138
  explanations = {
139
  'Proust': "Marcel Proust, known for his introspective and lengthy novel 'In Search of Lost Time', which explores themes of memory and time.",
@@ -166,19 +164,48 @@ explanations = {
166
  'Derrida': "Jacques Derrida, a philosopher best known for developing deconstruction, a critical approach that questions the relationship between text and meaning.",
167
  'Baudrillard': "Jean Baudrillard, a cultural theorist known for his analysis of consumerism, simulation, and hyperreality."
168
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
 
170
- # Function to return the explanation based on the selected artist or style
171
  def update_explanation(choice):
172
- return explanations.get(choice, "No explanation available.")
 
 
 
173
 
174
  # Define the Gradio interface using Blocks
175
  with gr.Blocks(theme = 'carlosrosash/bellay_test') as demo:
176
  gr.Markdown(title)
177
  gr.Markdown(description)
178
  with gr.Row():
179
- dropdown = gr.Dropdown(list_dropdown, label="Choose an Artist or Style")
180
- explanation_box = gr.Textbox(label="Explanation", type="text", lines=5, interactive=False)
181
- dropdown.change(update_explanation, inputs=dropdown, outputs=explanation_box)
 
182
 
183
  # Define the columns for input and output
184
  with gr.Row():
 
100
  Ut ac volutpat nisi.
101
  </p>
102
  """
 
103
  list_dropdown = [
104
  'Proust',
105
  'Encyclopédie',
 
132
  'Baudrillard',
133
  'Romans contemporains'
134
  ]
 
135
  # Dictionary of explanations for each artist or style
136
  explanations = {
137
  'Proust': "Marcel Proust, known for his introspective and lengthy novel 'In Search of Lost Time', which explores themes of memory and time.",
 
164
  'Derrida': "Jacques Derrida, a philosopher best known for developing deconstruction, a critical approach that questions the relationship between text and meaning.",
165
  'Baudrillard': "Jean Baudrillard, a cultural theorist known for his analysis of consumerism, simulation, and hyperreality."
166
  }
167
+ image_urls = {
168
+ 'Proust': "http://t1.gstatic.com/licensed-image?q=tbn:ANd9GcS_zFylvV8-QHOVHSO1TClcYm_gt00YW1rC4j8ZHfLr2eCFsrPI3q8Q_BhzTLdIk-n0",
169
+ 'Encyclopédie': "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2b/Encyclopedie_de_D%27Alembert_et_Diderot_-_Premiere_Page_-_ENC_1-NA5.jpg/1024px-Encyclopedie_de_D%27Alembert_et_Diderot_-_Premiere_Page_-_ENC_1-NA5.jpg",
170
+ 'Balzac': "https://t3.gstatic.com/licensed-image?q=tbn:ANd9GcTlbvVdT2S3WB3ddx7cAl3PyMVTzuInIy-JnZPz5Pfay-xmqZbubnOIH4zzDvhYzmBV",
171
+ 'Montaigne':"https://upload.wikimedia.org/wikipedia/commons/a/ac/Montaigne-Dumonstier.jpg",
172
+ 'Foucault':"https://upload.wikimedia.org/wikipedia/commons/thumb/7/76/Michel_Foucault_1974_Brasil.jpg/260px-Michel_Foucault_1974_Brasil.jpg",
173
+ 'Chansons de gestes':"https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/QuatrefilsAymonmanuscritXVe.jpg/220px-QuatrefilsAymonmanuscritXVe.jpg",
174
+ 'Constitutions françaises':"https://www.le-livre.fr/photos/RO4/RO40203585.jpg",
175
+ 'La Fontaine':"https://upload.wikimedia.org/wikipedia/commons/d/dd/Jean_de_La_Fontaine.PNG",
176
+ 'Madame de Sévigné':"https://upload.wikimedia.org/wikipedia/commons/1/1e/Madame_de_Sevigne_Lefebvre.jpg",
177
+ 'Molière':"https://theatre-contemporain.net/images/upload/persons/a/6/normal-normal-428x640-373.jpg",
178
+ 'Racine':"https://magny-les-hameaux.fr/sites/magny-les-hameaux/files/image/2020-09/Jean%20Racine.jpg",
179
+ 'Théâtre absurde':"https://upload.wikimedia.org/wikipedia/commons/d/d6/En_attendant_Godot%2C_Festival_d%27Avignon%2C_1978.jpeg",
180
+ 'Romans belle époque':"https://www.geo.fr/imgre/fit/~1~geo~2022~09~07~5a10df00-dc69-4e4c-8ee4-81ebef1c1717.jpeg/1200x630/cr/wqkgR2V0dHkgSW1hZ2VzIC8gR0VP/la-belle-epoque-etait-elle-si-belle.jpg",
181
+ 'Bible Segond':"https://upload.wikimedia.org/wikipedia/commons/8/8b/Bible_Segong_21_-_1.jpg",
182
+ 'Zola':"https://upload.wikimedia.org/wikipedia/commons/5/5a/Emile_Zola_1902.jpg",
183
+ 'Pagnol':"https://upload.wikimedia.org/wikipedia/commons/7/79/Pagnol_Harcourt_1948.jpg",
184
+ 'Poésies':"https://www.ville-castres.fr/sites/default/files/thumbnails/image/poesie-1.png",
185
+ 'De Gaulle':"https://www.elysee.fr/cdn-cgi/image/width=720%2Cheight=1080/images/default/0001/02/2b14cc268d0be2c7c7605bca866fea0c24d55d09.jpeg",
186
+ 'Duras':"https://upload.wikimedia.org/wikipedia/commons/1/12/Identite-Duras-1960-Sacem.png",
187
+ 'Braudel':"https://www.radiofrance.fr/s3/cruiser-production/2017/12/1ec62d38-1e2b-4410-8763-f956716f7010/250x250_043_aur_braudel_01.jpg",
188
+ 'Bourdieu':"https://www.scienceshumaines.com/images/p.bourdieu_.jpg",
189
+ 'Derrida':"https://www.philomag.com/sites/default/files/images/derrida_leemage.prt385js_042-copie.jpg",
190
+ 'Baudrillard':"https://www.philomag.com/sites/default/files/styles/sidebar_full_image/public/images/baudrillard_leemage.eff2022.jpg"
191
+ }
192
 
193
+ # Function to return the explanation and the image based on the selected artist or style
194
  def update_explanation(choice):
195
+ explanation_text = explanations.get(choice, "No explanation available.")
196
+ image_url = image_urls.get(choice, "default_image_url_if_not_found")
197
+ image_html = f"<img src='{image_url}' style='max-height: 200px; max-width: 200px; display: block; margin-left: auto; margin-right: auto; order: 2'/>"
198
+ return explanation_text, image_html
199
 
200
  # Define the Gradio interface using Blocks
201
  with gr.Blocks(theme = 'carlosrosash/bellay_test') as demo:
202
  gr.Markdown(title)
203
  gr.Markdown(description)
204
  with gr.Row():
205
+ dropdown = gr.Dropdown(list_dropdown, label="Choose an Artist or Style")
206
+ explanation_box = gr.Textbox(label="Explanation", type="text", lines=5, interactive=False)
207
+ explanation_image = gr.HTML(label="Image") # Display image
208
+ dropdown.change(update_explanation, inputs=dropdown, outputs=[explanation_box, explanation_image])
209
 
210
  # Define the columns for input and output
211
  with gr.Row():