Skym616 commited on
Commit
f29cb3e
·
1 Parent(s): 0bd25ee
__pycache__/functions.cpython-310.pyc CHANGED
Binary files a/__pycache__/functions.cpython-310.pyc and b/__pycache__/functions.cpython-310.pyc differ
 
app.py CHANGED
@@ -46,7 +46,7 @@ with col2:
46
  button = st.button("Prédire", use_container_width=True)
47
  if button:
48
  predicted, confidence = predict(uploaded_file)
49
- diagnosis_prompt = get_diagnosis(predicted, confidence)
50
  diagnosis = generate_text(diagnosis_prompt)
51
  summary = summarize_text(diagnosis)
52
  translation = translate_fr_to_es(summary)
@@ -59,6 +59,7 @@ if uploaded_file and translation:
59
  <div class="container card border-0 shadow-sm p-4 mt-2">
60
  <div class="card-body">
61
  <h2 class="gradient-text"> Resultat de la prédiction </h2>
 
62
  <p class="lead"> {summary} </p>
63
  </div>
64
  </div>
@@ -71,6 +72,7 @@ if uploaded_file and translation:
71
  """,
72
  unsafe_allow_html=True,
73
  )
 
74
 
75
  st.markdown(
76
  f"""
@@ -83,9 +85,7 @@ if uploaded_file and translation:
83
  """,
84
  unsafe_allow_html=True,
85
  )
86
- _, col2, _ = st.columns([2, 3, 2])
87
- with col2:
88
- st.audio(output_path, format="audio/mp3")
89
 
90
  # Afficher le pied de page
91
  show_footer(linkedin_image_base64, github_image_base64, huggingface_image_base64)
 
46
  button = st.button("Prédire", use_container_width=True)
47
  if button:
48
  predicted, confidence = predict(uploaded_file)
49
+ diagnosis_prompt, label = get_diagnosis(predicted, confidence)
50
  diagnosis = generate_text(diagnosis_prompt)
51
  summary = summarize_text(diagnosis)
52
  translation = translate_fr_to_es(summary)
 
59
  <div class="container card border-0 shadow-sm p-4 mt-2">
60
  <div class="card-body">
61
  <h2 class="gradient-text"> Resultat de la prédiction </h2>
62
+ <h4 class="gradient-text text-underline"> Type de tumeur: {label} </h3>
63
  <p class="lead"> {summary} </p>
64
  </div>
65
  </div>
 
72
  """,
73
  unsafe_allow_html=True,
74
  )
75
+ st.audio(output_path, format="audio/mp3")
76
 
77
  st.markdown(
78
  f"""
 
85
  """,
86
  unsafe_allow_html=True,
87
  )
88
+
 
 
89
 
90
  # Afficher le pied de page
91
  show_footer(linkedin_image_base64, github_image_base64, huggingface_image_base64)
functions.py CHANGED
@@ -23,8 +23,8 @@ def summarize_text(text):
23
  def get_diagnosis(prediction, confidence):
24
  labels = ["glioma", "meningioma", "notumor", "pituitary"]
25
  result = labels[prediction]
26
- prompt = f'Tu es un médecin qui s\'appelle Skym qui doit annoncer à un patient X le type de tumeur qu\'il a. Le type de tumeur prédit est "{result}" avec une confiance de {confidence}. Veuillez fournir un diagnostic concis, précis et des conseils.'
27
- return prompt
28
 
29
 
30
  def generate_text(input_text, max_retries=3):
 
23
  def get_diagnosis(prediction, confidence):
24
  labels = ["glioma", "meningioma", "notumor", "pituitary"]
25
  result = labels[prediction]
26
+ prompt = f'Tu es un médecin (neurologue) qui s\'appelle Skym qui doit annoncer à un patient X le type de tumeur qu\'il a. Le type de tumeur prédit est "{result}" avec une confiance de {confidence}. Veuillez fournir un diagnostic concis, précis et des conseils.'
27
+ return prompt, result
28
 
29
 
30
  def generate_text(input_text, max_retries=3):
text_to_speech.mp3 CHANGED
Binary files a/text_to_speech.mp3 and b/text_to_speech.mp3 differ