Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,12 @@ Exemple : 12,5 devient 12.5
|
|
21 |
|
22 |
Contact : +241065362371"""
|
23 |
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
description_ocr = (
|
26 |
"""Quand tu finis d'importer le texte sélectionne le et copie le !!!!"""
|
27 |
)
|
@@ -135,6 +140,37 @@ CONCLUSION
|
|
135 |
return answer
|
136 |
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
def calcul(math, francais, physique, svt, philo, eps, thea, hist, anglais):
|
139 |
math = math * 5
|
140 |
francais = francais * 3
|
@@ -201,6 +237,20 @@ app4 = gr.Interface(
|
|
201 |
outputs=gr.Textbox(),
|
202 |
)
|
203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
# interface5
|
205 |
app5 = gr.Interface(
|
206 |
fn=calcul,
|
@@ -220,8 +270,8 @@ app5 = gr.Interface(
|
|
220 |
)
|
221 |
|
222 |
demo = gr.TabbedInterface(
|
223 |
-
[app1, app2, app3, app4,
|
224 |
-
["OCR", "MARIAM-u", "Mariam-French", "Mariam-Philo", "Note Calc"],
|
225 |
)
|
226 |
|
227 |
demo.launch()
|
|
|
21 |
|
22 |
Contact : +241065362371"""
|
23 |
|
24 |
+
description_hist = """" Cest comme tu vois là. avant de cliquer su soummetre precise les differents points que tu veux aborder.
|
25 |
+
exemple :
|
26 |
+
p1 = Cause
|
27 |
+
p2 = manifestation
|
28 |
+
p3 = resolution
|
29 |
+
"""
|
30 |
description_ocr = (
|
31 |
"""Quand tu finis d'importer le texte sélectionne le et copie le !!!!"""
|
32 |
)
|
|
|
140 |
return answer
|
141 |
|
142 |
|
143 |
+
def gpt_hist(hist_prompt,p_1,p_2,p_3):
|
144 |
+
|
145 |
+
if not gpt_hist:
|
146 |
+
return "Veuillez saisir un thème ."
|
147 |
+
histt_prompt = f"""Je veux que tu me traite mon travail d'histoire de niveau lycé sous la forme d'une dissertation . La question du travail est la suivante: "{hist_prompt}". les different points a detailler sont :{p_1},{p_2}, {p_3}. en te basant sur le plan suivant :
|
148 |
+
INTRODUCTION:
|
149 |
+
- approche par definition du sujet, par constat ou rappel historique( du general au particulier/cas particulier au general )
|
150 |
+
- problematique/probleme du sujet
|
151 |
+
- annonce du plan
|
152 |
+
|
153 |
+
DEVELOPPEMENT
|
154 |
+
|
155 |
+
pour chaque point enonce. je voudrais
|
156 |
+
trois paragraphe contenant 1 arguments chacun. il faudra une phrase chapeau au debut et une phrase de transition a la fin de chaque point.
|
157 |
+
|
158 |
+
CONCLUSION
|
159 |
+
|
160 |
+
1. Bilan de la réflexion.
|
161 |
+
2. question douverture du sujet.
|
162 |
+
"""
|
163 |
+
response = openai.Completion.create(
|
164 |
+
model="text-davinci-003",
|
165 |
+
prompt=histt_prompt,
|
166 |
+
temperature=0.9,
|
167 |
+
max_tokens=3900,
|
168 |
+
top_p=1,
|
169 |
+
)
|
170 |
+
answer = response.choices[0].text.strip()
|
171 |
+
print(answer)
|
172 |
+
return answer
|
173 |
+
|
174 |
def calcul(math, francais, physique, svt, philo, eps, thea, hist, anglais):
|
175 |
math = math * 5
|
176 |
francais = francais * 3
|
|
|
237 |
outputs=gr.Textbox(),
|
238 |
)
|
239 |
|
240 |
+
#interface6
|
241 |
+
app6 = gr.Interface(
|
242 |
+
fn=gpt_hist,
|
243 |
+
title="Mariam-Hist",
|
244 |
+
description=description_hist,
|
245 |
+
inputs=[gr.Textbox(label="Sujet:", lines=2),gr.Textbox(label="point1:", lines=1),
|
246 |
+
gr.Textbox(label="point2:", lines=1),
|
247 |
+
gr.Textbox(label="point3:", lines=1)
|
248 |
+
|
249 |
+
],
|
250 |
+
outputs=gr.Textbox(),
|
251 |
+
)
|
252 |
+
|
253 |
+
|
254 |
# interface5
|
255 |
app5 = gr.Interface(
|
256 |
fn=calcul,
|
|
|
270 |
)
|
271 |
|
272 |
demo = gr.TabbedInterface(
|
273 |
+
[app1, app2, app3, app4,app6,app5],
|
274 |
+
["OCR", "MARIAM-u", "Mariam-French", "Mariam-Philo","Mariam-Hist", "Note Calc"],
|
275 |
)
|
276 |
|
277 |
demo.launch()
|