Alejo760 commited on
Commit
126a558
verified
1 Parent(s): 95094b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -5
app.py CHANGED
@@ -3,10 +3,51 @@ import os
3
  import fitz # PyMuPDF
4
  from langchain.text_splitter import RecursiveCharacterTextSplitter
5
  from langchain_community.embeddings import HuggingFaceEmbeddings # Importaci贸n actualizada
6
- from langchain.vectorstores import FAISS
7
  from groq import Groq
8
  from langchain_groq import ChatGroq
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  client = Groq(
12
  api_key=os.environ.get("GROQ_API_KEY"),
@@ -106,7 +147,12 @@ def process_input(audio, pdfs):
106
  return organized_record.content
107
 
108
  theme = gr.themes.Base(
109
- primary_hue=gr.themes.Color(c100="#fce7f3", c200="#fbcfe8", c300="#f9a8d4", c400="#f472b6", c50="#fdf2f8", c500="#ff4da6", c600="#db2777", c700="#ff299b", c800="#f745b6", c900="#ff38ac", c950="#e1377e"),
 
 
 
 
 
110
  secondary_hue="pink",
111
  neutral_hue="neutral",
112
  )
@@ -115,12 +161,16 @@ iface = gr.Interface(
115
  fn=process_input,
116
  inputs=[
117
  gr.Audio(sources=["microphone"], type="filepath"),
118
- gr.File(file_types=[".pdf"], label="Subir PDFs", optional=True, multiple=True, type="filepath")
 
 
 
 
119
  ],
120
- outputs="text",
121
  live=True,
122
- concurrency_limit=4,
123
  theme=theme
124
  )
 
125
  iface.launch(auth=[("her", "her")])
126
 
 
3
  import fitz # PyMuPDF
4
  from langchain.text_splitter import RecursiveCharacterTextSplitter
5
  from langchain_community.embeddings import HuggingFaceEmbeddings # Importaci贸n actualizada
6
+ from langchain_community.vectorstores import FAISS # Importaci贸n actualizada
7
  from groq import Groq
8
  from langchain_groq import ChatGroq
9
 
10
+ # Inicializar el modelo LLM
11
+ client = Groq(
12
+ api_key=os.environ.get("GROQ_API_KEY"),
13
+ )
14
+ chat_groq = ChatGroq(model="llama-3.1-70b-versatile")
15
+
16
+ # Resto de tus funciones (sin cambios)...
17
+
18
+ def process_input(audio, pdfs):
19
+ # Tu c贸digo existente...
20
+ pass
21
+
22
+ theme = gr.themes.Base(
23
+ primary_hue=gr.themes.Color(
24
+ c100="#fce7f3", c200="#fbcfe8", c300="#f9a8d4",
25
+ c400="#f472b6", c50="#fdf2f8", c500="#ff4da6",
26
+ c600="#db2777", c700="#ff299b", c800="#f745b6",
27
+ c900="#ff38ac", c950="#e1377e"
28
+ ),
29
+ secondary_hue="pink",
30
+ neutral_hue="neutral",
31
+ )
32
+
33
+ iface = gr.Interface(
34
+ fn=process_input,
35
+ inputs=[
36
+ gr.Audio(sources=["microphone"], type="filepath"),
37
+ gr.File(file_types=[".pdf"], label="Subir PDFs", multiple=True, type="filepath") # Se elimin贸 'optional'
38
+ ],
39
+ outputs=[
40
+ gr.Textbox(label="Registro Cl铆nico Organizado"),
41
+ gr.Textbox(label="Informaci贸n de Depuraci贸n")
42
+ ],
43
+ live=True,
44
+ concurrency_count=4, # Actualizado de 'concurrency_limit'
45
+ theme=theme
46
+ )
47
+
48
+ iface.launch(auth=[("her", "her")])
49
+
50
+
51
 
52
  client = Groq(
53
  api_key=os.environ.get("GROQ_API_KEY"),
 
147
  return organized_record.content
148
 
149
  theme = gr.themes.Base(
150
+ primary_hue=gr.themes.Color(
151
+ c100="#fce7f3", c200="#fbcfe8", c300="#f9a8d4",
152
+ c400="#f472b6", c50="#fdf2f8", c500="#ff4da6",
153
+ c600="#db2777", c700="#ff299b", c800="#f745b6",
154
+ c900="#ff38ac", c950="#e1377e"
155
+ ),
156
  secondary_hue="pink",
157
  neutral_hue="neutral",
158
  )
 
161
  fn=process_input,
162
  inputs=[
163
  gr.Audio(sources=["microphone"], type="filepath"),
164
+ gr.File(file_types=[".pdf"], label="Subir PDFs", multiple=True, type="filepath") # Se elimin贸 'optional'
165
+ ],
166
+ outputs=[
167
+ gr.Textbox(label="Registro Cl铆nico Organizado"),
168
+ gr.Textbox(label="Informaci贸n de Depuraci贸n")
169
  ],
 
170
  live=True,
171
+ concurrency_count=4, # Actualizado de 'concurrency_limit'
172
  theme=theme
173
  )
174
+
175
  iface.launch(auth=[("her", "her")])
176