paula-st commited on
Commit
6a7ce94
·
verified ·
1 Parent(s): 63b1698

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -3,7 +3,7 @@ from transformers import pipeline
3
 
4
  # Lade Modelle von Hugging Face
5
  llama_pipeline = pipeline("text-generation", model="meta-llama/Meta-Llama-3-8B")
6
- finbert_pipeline = pipeline("text-classification", model="ProsusAI/finbert")
7
 
8
  # Funktion für die Analyse
9
  def analyze_financial_text(model_choice, text_input):
@@ -14,9 +14,9 @@ def analyze_financial_text(model_choice, text_input):
14
  response = llama_pipeline(text_input, max_length=200, do_sample=True)
15
  return response[0]["generated_text"]
16
 
17
- elif model_choice == "FinBERT (Sentiment-Analyse)":
18
- response = finbert_pipeline(text_input)
19
- return f"Ergebnis: {response[0]['label']} (Score: {response[0]['score']:.2f})"
20
 
21
  return "Ungültige Auswahl."
22
 
@@ -25,7 +25,8 @@ with gr.Blocks() as demo:
25
  gr.Markdown("# Finanz-Analyse mit Sprachmodellen (LLaMA 3 & FinBERT)")
26
 
27
  model_choice = gr.Radio(
28
- choices=["LLaMA 3 (Text-Generierung)", "FinBERT (Sentiment-Analyse)"],
 
29
  label="Wähle ein Modell",
30
  value="LLaMA 3 (Text-Generierung)"
31
  )
 
3
 
4
  # Lade Modelle von Hugging Face
5
  llama_pipeline = pipeline("text-generation", model="meta-llama/Meta-Llama-3-8B")
6
+ #finbert_pipeline = pipeline("text-classification", model="ProsusAI/finbert")
7
 
8
  # Funktion für die Analyse
9
  def analyze_financial_text(model_choice, text_input):
 
14
  response = llama_pipeline(text_input, max_length=200, do_sample=True)
15
  return response[0]["generated_text"]
16
 
17
+ #elif model_choice == "FinBERT (Sentiment-Analyse)":
18
+ #response = finbert_pipeline(text_input)
19
+ #return f"Ergebnis: {response[0]['label']} (Score: {response[0]['score']:.2f})"
20
 
21
  return "Ungültige Auswahl."
22
 
 
25
  gr.Markdown("# Finanz-Analyse mit Sprachmodellen (LLaMA 3 & FinBERT)")
26
 
27
  model_choice = gr.Radio(
28
+ #choices=["LLaMA 3 (Text-Generierung)", "FinBERT (Sentiment-Analyse)"],
29
+ choices=["LLaMA 3 (Text-Generierung)"],
30
  label="Wähle ein Modell",
31
  value="LLaMA 3 (Text-Generierung)"
32
  )