cotxetj commited on
Commit
528a2e0
1 Parent(s): 02195ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -9,6 +9,7 @@ import matplotlib.pyplot as plt
9
  data = {
10
  'Topic': ['Topic1', 'Topic1', 'Topic2', 'Topic2'],
11
  'Article': ['Article1', 'Article2', 'Article3', 'Article4'],
 
12
  'Keywords': ['key1 key2 key3', 'key4 key5', 'key6 key7', 'key8 key9 key10 key10 key10 key10']
13
  }
14
 
@@ -19,7 +20,12 @@ def display_topics(topic):
19
  # Filter DataFrame based on the selected topic
20
  selected_data = df[df['Topic'] == topic]
21
  # Display relevant articles
22
- articles = "\n".join(selected_data['Article'])
 
 
 
 
 
23
 
24
  # Generate word cloud for keywords
25
  keywords = " ".join(selected_data['Keywords'])
@@ -28,7 +34,7 @@ def display_topics(topic):
28
  plt.axis("off")
29
  ax =plt.imshow(wordcloud, interpolation='bilinear')
30
 
31
- return f"{articles}", fig
32
 
33
  # Define Gradio interface
34
  iface = gr.Interface(
 
9
  data = {
10
  'Topic': ['Topic1', 'Topic1', 'Topic2', 'Topic2'],
11
  'Article': ['Article1', 'Article2', 'Article3', 'Article4'],
12
+ 'Link' : ['https://www.google.fr']* 4
13
  'Keywords': ['key1 key2 key3', 'key4 key5', 'key6 key7', 'key8 key9 key10 key10 key10 key10']
14
  }
15
 
 
20
  # Filter DataFrame based on the selected topic
21
  selected_data = df[df['Topic'] == topic]
22
  # Display relevant articles
23
+ articles = selected_data['Article']
24
+ links = selected_data['Link']
25
+ articles_ret = ""
26
+ for i, elem in enumerate(articles):
27
+ articles_ret += f"[{elem}]({links[i]}) \n"
28
+ print(articles_ret)
29
 
30
  # Generate word cloud for keywords
31
  keywords = " ".join(selected_data['Keywords'])
 
34
  plt.axis("off")
35
  ax =plt.imshow(wordcloud, interpolation='bilinear')
36
 
37
+ return articles_ret , fig
38
 
39
  # Define Gradio interface
40
  iface = gr.Interface(