ivan-savchuk commited on
Commit
24875d5
β€’
1 Parent(s): 63ffd0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -44
app.py CHANGED
@@ -75,52 +75,20 @@ if __name__ == "__main__":
75
 
76
  # define container for answers
77
  with st.container():
 
78
  # show which query was entered, and what was searching time
79
- st.write(f"**Results Related to:** {query} ({elapsed_time} sec.)")
80
- # answer starts with header
81
- st.subheader(f"Answer 1")
82
- # cropped answer
83
- doc = results[0]["doc"][:150] + "..."
84
- # and url to the full answer
85
- url = results[0]["url"]
86
- # then we display it
87
- st.markdown(f"{doc}\n[<span style=\"color:Blue\">**Read More**</span>]({url})\n")
88
 
89
- # answer starts with header
90
- st.subheader(f"Answer 2")
91
- # cropped answer
92
- doc = results[1]["doc"][:150] + "..."
93
- # and url to the full answer
94
- url = results[1]["url"]
95
- # then we display it
96
- st.markdown(f"{doc}\n[<span style=\"color:Blue\">**Read More**</span>]({url})\n")
97
-
98
- # answer starts with header
99
- st.subheader(f"Answer 3")
100
- # cropped answer
101
- doc = results[2]["doc"][:150] + "..."
102
- # and url to the full answer
103
- url = results[2]["url"]
104
- # then we display it
105
- st.markdown(f"{doc}\n[<span style=\"color:Blue\">**Read More**</span>]({url})\n")
106
-
107
- # answer starts with header
108
- st.subheader(f"Answer 4")
109
- # cropped answer
110
- doc = results[3]["doc"][:150] + "..."
111
- # and url to the full answer
112
- url = results[3]["url"]
113
- # then we display it
114
- st.markdown(f"{doc}\n[<span style=\"color:Blue\">**Read More**</span>]({url})\n")
115
-
116
- # answer starts with header
117
- st.subheader(f"Answer 5")
118
- # cropped answer
119
- doc = results[4]["doc"][:150] + "..."
120
- # and url to the full answer
121
- url = results[4]["url"]
122
- # then we display it
123
- st.markdown(f"{doc}\n[<span style=\"color:Blue\">**Read More**</span>]({url})\n")
124
 
125
  st.markdown("---")
126
  st.markdown("Author: Ivan Savchuk. 2022")
 
75
 
76
  # define container for answers
77
  with st.container():
78
+ st.empty()
79
  # show which query was entered, and what was searching time
80
+ st.write(f'**Results Related to:** "{query}" ({elapsed_time} sec.)')
 
 
 
 
 
 
 
 
81
 
82
+ # then we use loop to show results
83
+ for i, answer in enumerate(results):
84
+ # answer starts with header
85
+ st.subheader(f"Answer {i+1}")
86
+ # cropped answer
87
+ doc = answer["doc"][:150] + "..."
88
+ # and url to the full answer
89
+ url = answer["url"]
90
+ # then we display it
91
+ st.markdown(f"{doc}\n[**Read More**]({url})\n")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
  st.markdown("---")
94
  st.markdown("Author: Ivan Savchuk. 2022")