Update app.py
Browse files
app.py
CHANGED
@@ -133,7 +133,7 @@ model_id_7 = "oliverguhr/german-sentiment-bert"
|
|
133 |
from transformers import pipeline
|
134 |
|
135 |
#
|
136 |
-
##
|
137 |
#"['audio-classification', 'automatic-speech-recognition', 'conversational', 'depth-estimation', 'document-question-answering',
|
138 |
#'feature-extraction', 'fill-mask', 'image-classification', 'image-segmentation', 'image-to-text', 'mask-generation', 'ner',
|
139 |
#'object-detection', 'question-answering', 'sentiment-analysis', 'summarization', 'table-question-answering', 'text-classification',
|
@@ -142,11 +142,19 @@ from transformers import pipeline
|
|
142 |
#'translation_XX_to_YY']"
|
143 |
##
|
144 |
|
145 |
-
|
146 |
#pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
147 |
|
148 |
-
def
|
149 |
-
sentiment_result =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
print(sentiment_result)
|
151 |
return sentiment_result
|
152 |
|
@@ -182,10 +190,6 @@ def predict(text):
|
|
182 |
chat_model_facebook_blenderbot_400M_distill = "facebook/blenderbot-400M-distill"
|
183 |
chat_model_HenryJJ_vincua_13b = "HenryJJ/vincua-13b"
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
text = "Why did the chicken cross the road?"
|
190 |
|
191 |
#output_question_1 = llm_hf(text)
|
@@ -259,9 +263,18 @@ def topic_sale_inform (text):
|
|
259 |
print (res)
|
260 |
return res
|
261 |
|
262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
# create a public link, set `share=True` in `launch()
|
264 |
-
|
265 |
####################
|
266 |
|
267 |
|
|
|
133 |
from transformers import pipeline
|
134 |
|
135 |
#
|
136 |
+
## Possible pipeline
|
137 |
#"['audio-classification', 'automatic-speech-recognition', 'conversational', 'depth-estimation', 'document-question-answering',
|
138 |
#'feature-extraction', 'fill-mask', 'image-classification', 'image-segmentation', 'image-to-text', 'mask-generation', 'ner',
|
139 |
#'object-detection', 'question-answering', 'sentiment-analysis', 'summarization', 'table-question-answering', 'text-classification',
|
|
|
142 |
#'translation_XX_to_YY']"
|
143 |
##
|
144 |
|
145 |
+
sentiment_pipe = pipeline("sentiment-analysis", model=model_id_7)
|
146 |
#pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
147 |
|
148 |
+
def pipeline_predict_sentiment(text):
|
149 |
+
sentiment_result = sentiment_pipe(text)
|
150 |
+
print(sentiment_result)
|
151 |
+
return sentiment_result
|
152 |
+
|
153 |
+
|
154 |
+
chat_pipe = pipeline("conversational")
|
155 |
+
|
156 |
+
def pipeline_predict_chat(text):
|
157 |
+
sentiment_result = chat_pipe(text)
|
158 |
print(sentiment_result)
|
159 |
return sentiment_result
|
160 |
|
|
|
190 |
chat_model_facebook_blenderbot_400M_distill = "facebook/blenderbot-400M-distill"
|
191 |
chat_model_HenryJJ_vincua_13b = "HenryJJ/vincua-13b"
|
192 |
|
|
|
|
|
|
|
|
|
193 |
text = "Why did the chicken cross the road?"
|
194 |
|
195 |
#output_question_1 = llm_hf(text)
|
|
|
263 |
print (res)
|
264 |
return res
|
265 |
|
266 |
+
|
267 |
+
|
268 |
+
####
|
269 |
+
|
270 |
+
def callChains(current_message):
|
271 |
+
sentiment_analysis_result = pipeline_predict_sentiment(message)
|
272 |
+
topic_sale_inform = topic_sale_inform(message)
|
273 |
+
|
274 |
+
|
275 |
+
chat_bot = gr.Interface(fn=callChains , inputs="textbox", outputs=["textbox","textbox","textbox"], title="Conversation Bot with extra")
|
276 |
# create a public link, set `share=True` in `launch()
|
277 |
+
chat_bot.launch()
|
278 |
####################
|
279 |
|
280 |
|