Spaces:
Runtime error
Runtime error
Commit
·
da07b50
1
Parent(s):
6805181
Upload app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,7 @@ orange = [197/255, 90/255, 17/255]
|
|
37 |
|
38 |
|
39 |
# Pipelines definieren
|
40 |
-
en_de_translator = pipeline("translation_de_to_en", model='google/bert2bert_L-24_wmt_de_en')
|
41 |
qa_pipeline = pipeline("question-answering", model='deepset/gelectra-base-germanquad')
|
42 |
sentiment = pipeline("text-classification", model='oliverguhr/german-sentiment-bert')
|
43 |
|
@@ -47,7 +47,7 @@ tab1, tab2, tab3, tab4 = st.tabs(
|
|
47 |
|
48 |
with tab1:
|
49 |
st.markdown(
|
50 |
-
'Definieren Sie ein neuronales Netz und beobachten Sie wie sich die Kurve krümmen kann um die Daten zu fitten')
|
51 |
|
52 |
col1, col2 = tab1.columns(2)
|
53 |
size = np.array([12., 27., 32., 47., 58., 56., 58., 61.,
|
@@ -155,7 +155,7 @@ with tab1:
|
|
155 |
with tab2:
|
156 |
|
157 |
st.markdown(
|
158 |
-
'Definieren Sie Sätze, die positiv oder negativ gestimmt sind und beobachten Sie die
|
159 |
|
160 |
text_input_2 = '1: Das schöne Allgäu\n' + \
|
161 |
'1: So toll hier im Allgäu\n' + \
|
@@ -203,7 +203,7 @@ with tab2:
|
|
203 |
model.compile(optimizer='adam', loss='binary_crossentropy',
|
204 |
metrics=['accuracy'])
|
205 |
|
206 |
-
model.fit(text, labels, epochs=2000, verbose=
|
207 |
|
208 |
# Word Vektoren grafisch darstellen
|
209 |
cb = [15/255, 25/255, 35/255]
|
@@ -264,7 +264,7 @@ with tab2:
|
|
264 |
with tab3:
|
265 |
|
266 |
st.markdown(
|
267 |
-
'Definieren Sie Sätze bei denen beliebige Wörter maskiert werden, um allgemeine Bezüge in Wort-Vektoren
|
268 |
|
269 |
text_input = 'Das schöne Allgäu\n' + \
|
270 |
'Das wunderbare Allgäu\n' + \
|
@@ -369,22 +369,6 @@ with tab4:
|
|
369 |
#st.text("Übersetzung: Deutsch --> Englisch")
|
370 |
st.markdown('Probieren Sie verschiedene Pipelines der Transformer-Bibliothek von HuggingFace.')
|
371 |
|
372 |
-
text_input_3 = 'Wir ünterstützen Unternehmen bei der Datenanalyse durch individuelle Beratung und Projekte mit besonderem Fokus auf maschinelles Lernen und Deep Learning.'
|
373 |
-
|
374 |
-
string_3 = st.text_area('Übersetzung: Deutsch --> Englisch', value=text_input_3, height=75)
|
375 |
-
|
376 |
-
if st.button('Ein fertig trainiertes Transformer-Modell von HuggingFace anwenden', key=3):
|
377 |
-
with st.spinner('Die Übersetzung kann einige Sekunden dauern ...'):
|
378 |
-
|
379 |
-
a5 = en_de_translator(string_3)
|
380 |
-
st.text(a5)
|
381 |
-
|
382 |
-
#########################################################
|
383 |
-
st.text('')
|
384 |
-
st.markdown("""<hr style="height:10px;border:none;color:#333;background-color:#333;" /> """,
|
385 |
-
unsafe_allow_html=True)
|
386 |
-
st.text('')
|
387 |
-
|
388 |
text_input_4 = 'Was ist der Schwerpunkt?'
|
389 |
|
390 |
string_4 = st.text_area('Frage zum Kontext beantworten', value=text_input_4, height=25)
|
@@ -400,12 +384,13 @@ with tab4:
|
|
400 |
st.text(a5)
|
401 |
|
402 |
############################################################
|
|
|
403 |
st.text('')
|
404 |
st.markdown("""<hr style="height:10px;border:none;color:#333;background-color:#333;" /> """,
|
405 |
unsafe_allow_html=True)
|
406 |
st.text('')
|
407 |
|
408 |
-
text_input_7 = 'Wir lieben Data Science
|
409 |
|
410 |
string_7 = st.text_area('Stimmungsanalyse', value=text_input_7, height=25)
|
411 |
|
@@ -413,16 +398,15 @@ with tab4:
|
|
413 |
with st.spinner('Die Beurteilung der Stimmung kann einige Sekunden dauern ...'):
|
414 |
|
415 |
a5 = sentiment(string_7)
|
416 |
-
|
417 |
|
|
|
418 |
st.text('')
|
419 |
st.markdown("""<hr style="height:10px;border:none;color:#333;background-color:#333;" /> """,
|
420 |
unsafe_allow_html=True)
|
421 |
st.text('')
|
422 |
|
423 |
references = 'Verwendete Modelle:\n' + \
|
424 |
-
'\nÜbersetzung:\n' + \
|
425 |
-
'google/bert2bert_L-24_wmt_de_en, Autoren: Sascha Rothe, Shashi Narayan, Aliaksei Severyn' + \
|
426 |
'\n\nFrage beantworten:\n' + \
|
427 |
'deepset/gelectra-base-germanquad, Autoren: Timo Möller, Julian Risch, Malte Pietsch' + \
|
428 |
'\n\nStimmung:\n' + \
|
|
|
37 |
|
38 |
|
39 |
# Pipelines definieren
|
40 |
+
#en_de_translator = pipeline("translation_de_to_en", model='google/bert2bert_L-24_wmt_de_en')
|
41 |
qa_pipeline = pipeline("question-answering", model='deepset/gelectra-base-germanquad')
|
42 |
sentiment = pipeline("text-classification", model='oliverguhr/german-sentiment-bert')
|
43 |
|
|
|
47 |
|
48 |
with tab1:
|
49 |
st.markdown(
|
50 |
+
'Definieren Sie ein neuronales Netz und beobachten Sie wie sich die Kurve krümmen kann, um die Daten zu fitten')
|
51 |
|
52 |
col1, col2 = tab1.columns(2)
|
53 |
size = np.array([12., 27., 32., 47., 58., 56., 58., 61.,
|
|
|
155 |
with tab2:
|
156 |
|
157 |
st.markdown(
|
158 |
+
'Definieren Sie Sätze, die positiv oder negativ gestimmt sind und beobachten Sie die resultierenden Wort-Vektoren.')
|
159 |
|
160 |
text_input_2 = '1: Das schöne Allgäu\n' + \
|
161 |
'1: So toll hier im Allgäu\n' + \
|
|
|
203 |
model.compile(optimizer='adam', loss='binary_crossentropy',
|
204 |
metrics=['accuracy'])
|
205 |
|
206 |
+
model.fit(text, labels, epochs=2000, verbose=False)
|
207 |
|
208 |
# Word Vektoren grafisch darstellen
|
209 |
cb = [15/255, 25/255, 35/255]
|
|
|
264 |
with tab3:
|
265 |
|
266 |
st.markdown(
|
267 |
+
'Definieren Sie Sätze bei denen beliebige Wörter maskiert werden, um allgemeine Bezüge in Wort-Vektoren abzubilden.')
|
268 |
|
269 |
text_input = 'Das schöne Allgäu\n' + \
|
270 |
'Das wunderbare Allgäu\n' + \
|
|
|
369 |
#st.text("Übersetzung: Deutsch --> Englisch")
|
370 |
st.markdown('Probieren Sie verschiedene Pipelines der Transformer-Bibliothek von HuggingFace.')
|
371 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
372 |
text_input_4 = 'Was ist der Schwerpunkt?'
|
373 |
|
374 |
string_4 = st.text_area('Frage zum Kontext beantworten', value=text_input_4, height=25)
|
|
|
384 |
st.text(a5)
|
385 |
|
386 |
############################################################
|
387 |
+
|
388 |
st.text('')
|
389 |
st.markdown("""<hr style="height:10px;border:none;color:#333;background-color:#333;" /> """,
|
390 |
unsafe_allow_html=True)
|
391 |
st.text('')
|
392 |
|
393 |
+
text_input_7 = 'Wir lieben Data Science!'
|
394 |
|
395 |
string_7 = st.text_area('Stimmungsanalyse', value=text_input_7, height=25)
|
396 |
|
|
|
398 |
with st.spinner('Die Beurteilung der Stimmung kann einige Sekunden dauern ...'):
|
399 |
|
400 |
a5 = sentiment(string_7)
|
401 |
+
st.text(a5[0]['label'])
|
402 |
|
403 |
+
############################################################
|
404 |
st.text('')
|
405 |
st.markdown("""<hr style="height:10px;border:none;color:#333;background-color:#333;" /> """,
|
406 |
unsafe_allow_html=True)
|
407 |
st.text('')
|
408 |
|
409 |
references = 'Verwendete Modelle:\n' + \
|
|
|
|
|
410 |
'\n\nFrage beantworten:\n' + \
|
411 |
'deepset/gelectra-base-germanquad, Autoren: Timo Möller, Julian Risch, Malte Pietsch' + \
|
412 |
'\n\nStimmung:\n' + \
|