Update app.py
Browse files
app.py
CHANGED
|
@@ -42,6 +42,21 @@ def respond(
|
|
| 42 |
"""
|
| 43 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 44 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
demo = gr.ChatInterface(
|
| 46 |
respond,
|
| 47 |
additional_inputs=[
|
|
|
|
| 42 |
"""
|
| 43 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 44 |
"""
|
| 45 |
+
|
| 46 |
+
from transformers import pipeline
|
| 47 |
+
|
| 48 |
+
# Charger le modèle GOT-OCR2_0
|
| 49 |
+
ocr_model = pipeline('image-classification', model='stepfun-ai/GOT-OCR2_0')
|
| 50 |
+
|
| 51 |
+
# Charger l'image à traiter
|
| 52 |
+
image_path = 'radio.jpeg'
|
| 53 |
+
|
| 54 |
+
# Faire une prédiction (extraire le texte ou les objets détectés)
|
| 55 |
+
result = ocr_model(image_path)
|
| 56 |
+
|
| 57 |
+
# Afficher le résultat
|
| 58 |
+
print(result)
|
| 59 |
+
|
| 60 |
demo = gr.ChatInterface(
|
| 61 |
respond,
|
| 62 |
additional_inputs=[
|