kuro223 commited on
Commit
eb6384d
·
1 Parent(s): a2651cd
Files changed (1) hide show
  1. app.py +30 -67
app.py CHANGED
@@ -1,10 +1,8 @@
1
 
2
  import gradio as gr
3
- import openai
4
  import os
5
  import math as matha
6
 
7
- openai.api_key = os.environ.get("key")
8
  from gradio_client import Client
9
 
10
  client = Client("https://docfile-bhh.hf.space/")
@@ -24,64 +22,14 @@ Exemple : 12,5 devient 12.5
24
 
25
  Contact : +241065362371"""
26
 
27
-
28
- description_thea = """Je suis fatigué.
29
- Here is the suggested pronunciation for the dialogue:
30
-
31
- Inspector Smith is a busy man!
32
-
33
- Jeff Smith: So what happened, Madam? (pronounced: Jef Smith: So wat happend, Madam?)
34
-
35
- Lady: Well, I was in my car at the traffic lights. The door opened, a man came in and pushed me out. And he drove away with my car, my bag, my keys. (pronounced: Leydi: Wel, ai woz in may kar et dhe traffik laits. Dhe dor opend, a man kem in and pushd mi aut. And hi drov awey wit may kar, may bag, may kiz.)
36
-
37
- Jeff Smith: Lady, calm down, Madam. What make is your car? (pronounced: Jef Smith: Leydi, kam daun, Madam. Wat mek iz yor kar?)
38
-
39
- Lady: It's a Ford, a blue Ford. It was new too. I bought it a month ago! (pronounced: Leydi: Its a Ford, a blu Ford. It woz nu too. Ai bot it a munth ego!)
40
-
41
- Jeff Smith: What was the thief like? Was he tall? (pronounced: Jef Smith: Wat woz dhe tif laik? Woz hi tol?)
42
-
43
- Lady: Yes, he was taller than me. He had long blond hair. (pronounced: Leydi: Yes, hi woz tolur dan mi. Hi had long blon her.)
44
-
45
- Jeff Smith: It was probably a wig. What colour were his eyes? (pronounced: Jef Smith: It woz prabobli a wig. Wat kalar wer hiz aiz?)
46
-
47
- Lady: I don't know. He had sunglasses on. (pronounced: Leydi: Ai dont no. Hi had sanglasiz on.)
48
-
49
- Jeff Smith: Look at this photo. Is this our man? (pronounced: Jef Smith: Luk et dis foto. Iz dis aur man?)
50
-
51
- Lady: I'm not sure. The man I saw was slimmer, younger, and more athletic. (pronounced: Leydi: Aim not shur. Dhe man ai saw woz slimur, yongur, and mor athletik.)
52
-
53
- Bien sûr, voici la traduction en français :
54
-
55
- Inspecteur Smith est un homme occupé !
56
-
57
- Jeff Smith : Que s'est-il passé, Madame ?
58
-
59
- Dame : Eh bien, j'étais dans ma voiture aux feux de circulation. La porte s'est ouverte, un homme est entré et m'a poussée dehors. Et il est parti avec ma voiture, mon sac, mes clés.
60
-
61
- Jeff Smith : Calmez-vous, Madame. Quelle est la marque de votre voiture ?
62
-
63
- Dame : C'est une Ford, une Ford bleue. Elle était neuve aussi. Je l'ai achetée il y a un mois !
64
-
65
- Jeff Smith : À quoi ressemblait le voleur ? Était-il grand ?
66
-
67
- Dame : Oui, il était plus grand que moi. Il avait les cheveux blonds et longs.
68
-
69
- Jeff Smith : C'était probablement une perruque. De quelle couleur étaient ses yeux ?
70
-
71
- Dame : Je ne sais pas. Il portait des lunettes de soleil.
72
-
73
- Jeff Smith : Regardez cette photo. Est-ce notre homme ?
74
-
75
- Dame : Je n'en suis pas sûre. L'homme que j'ai vu était plus mince, plus jeune et plus athlétique.
76
- """
77
- description_hist = """" Cest comme tu vois là. avant de cliquer su soummetre precise les differents points que tu veux aborder.
78
  exemple :
79
  p1 = Cause
80
  p2 = manifestation
81
  p3 = resolution
82
  """
83
  description_ocr = (
84
- """Quand tu finis d'importer le texte sélectionne le et copie le !!!!"""
85
  )
86
 
87
  title_f = "Travail argumentative"
@@ -125,31 +73,46 @@ def infer(im):
125
  def gpt(prompt):
126
  if not prompt:
127
  return "Veuillez saisir une question."
128
- f_prompt = f""" Tu t'appelle Mariam et tu as été créer par Youssouf.
129
-
130
- résout ce problèmes:
131
- {prompt}. """
132
 
133
  answer = client.predict(
134
- f_prompt, # str in 'input_text' Textbox component
135
  api_name="/predict"
136
  )
137
 
138
  print(answer)
139
  return answer
 
140
  def gpt_francais(french_prompt,choix):
141
 
142
  if not french_prompt:
143
  return "Veuillez saisir un thème ."
144
- fi_prompt = f"""Je veux faire mon travail de français de niveau lycé sous la forme d'un travail argumentatif . La question du travail est la suivante: "{french_prompt}". tu devras {choix} ce thème. jai besoin dune introduction(avec une problématique et l'annonce du plan), de 3 arguments(avec explication et example et illustration) et d'une conclusion avec une ouverture(donné sous forme de phrase interogative ) """
145
-
146
- answer = client.predict(
147
- fi_prompt, # str in 'input_text' Textbox component
148
- api_name="/predict"
149
- )
150
 
151
- print(answer)
152
- return answer
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
 
155
  def gpt_philo(phi_prompt):
 
1
 
2
  import gradio as gr
 
3
  import os
4
  import math as matha
5
 
 
6
  from gradio_client import Client
7
 
8
  client = Client("https://docfile-bhh.hf.space/")
 
22
 
23
  Contact : +241065362371"""
24
 
25
+ description_hist = """" C'est comme tu vois là. avant de cliquer sur soumettre precise les differents points que tu veux aborder.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  exemple :
27
  p1 = Cause
28
  p2 = manifestation
29
  p3 = resolution
30
  """
31
  description_ocr = (
32
+ """ ici c'est juste pour extraire le texte d'une image... juste ça..."""
33
  )
34
 
35
  title_f = "Travail argumentative"
 
73
  def gpt(prompt):
74
  if not prompt:
75
  return "Veuillez saisir une question."
 
 
 
 
76
 
77
  answer = client.predict(
78
+ prompt, # str in 'input_text' Textbox component
79
  api_name="/predict"
80
  )
81
 
82
  print(answer)
83
  return answer
84
+
85
  def gpt_francais(french_prompt,choix):
86
 
87
  if not french_prompt:
88
  return "Veuillez saisir un thème ."
 
 
 
 
 
 
89
 
90
+ elif choix == "discuter":
91
+
92
+ d_prompt = """Je veux faire mon travail de français de niveau lycé sous la forme d'un travail argumentatif . La question du travail est la suivante: "{french_prompt}". tu devras etayer ce thème. jai besoin dune introduction(avec une problématique et l'annonce du plan), de 3 arguments(avec explication et example et illustration) et une phrase de transition pour refuter le sujet
93
+ """
94
+
95
+ te_fi = ""
96
+ answer = client.predict(
97
+ d_prompt,
98
+ api_name="/predict")
99
+ te_fi += answer +"\n\n"
100
+
101
+ de = """Je veux faire mon travail de français de niveau lycé sous la forme d'un travail argumentatif . La question du travail est la suivante: "{french_prompt}". tu devras refuter ce thème. jai juste besoin, de 3 arguments(avec explication et example et illustration) et d'une conclusion avec une ouverture(donné sous forme de phrase interogative ) """
102
+ answer = client.predict(
103
+ de,
104
+ api_name="/predict")
105
+
106
+ te_fi += answer
107
+ return te_fi
108
+ else:
109
+ fi_prompt = f"""Je veux faire mon travail de français de niveau lycé sous la forme d'un travail argumentatif . La question du travail est la suivante: "{french_prompt}". tu devras {choix} ce thème. jai besoin dune introduction(avec une problématique et l'annonce du plan), de 3 arguments(avec explication et example et illustration) et d'une conclusion avec une ouverture(donné sous forme de phrase interogative ) """
110
+
111
+ answer = client.predict(
112
+ fi_prompt,
113
+ api_name="/predict")
114
+ print(answer)
115
+ return answer
116
 
117
 
118
  def gpt_philo(phi_prompt):