Spaces:
Sleeping
Sleeping
spinner added
Browse files
app.py
CHANGED
@@ -56,28 +56,29 @@ if prompt := st.chat_input("What is up?"):
|
|
56 |
# Add user message to chat history
|
57 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
81 |
|
82 |
response = f"{doc}"
|
83 |
# Display assistant response in chat message container
|
|
|
56 |
# Add user message to chat history
|
57 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
58 |
|
59 |
+
with st.spinner("Wait for it..."):
|
60 |
+
if option == "Sentiment Analysis":
|
61 |
+
pipe_sentiment_analysis = pipeline("sentiment-analysis")
|
62 |
+
if prompt:
|
63 |
+
out = pipe_sentiment_analysis(prompt)
|
64 |
+
doc = f"""
|
65 |
+
Prompt: {prompt}
|
66 |
+
Sentiment: {out[0]["label"]}
|
67 |
+
Score: {out[0]["score"]}
|
68 |
+
"""
|
69 |
+
elif option == "Medical Summarization":
|
70 |
+
pipe_summarization = pipeline(
|
71 |
+
"summarization", model="Falconsai/medical_summarization"
|
72 |
+
)
|
73 |
+
if prompt:
|
74 |
+
out = pipe_summarization(prompt)
|
75 |
+
doc = out[0]["summary_text"]
|
76 |
+
elif option == "ChatGPT":
|
77 |
+
if prompt:
|
78 |
+
out = call_chatgpt(query=prompt)
|
79 |
+
doc = out
|
80 |
+
else:
|
81 |
+
doc = ""
|
82 |
|
83 |
response = f"{doc}"
|
84 |
# Display assistant response in chat message container
|