Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,28 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import from_pretrained_keras
|
| 3 |
|
| 4 |
-
# Load the model from Hugging Face
|
| 5 |
model = from_pretrained_keras("Bajiyo/Malayalam_transliteration")
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
def transliterate(input_text):
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
textbox = gr.inputs.Textbox(label="Enter Malayalam Text")
|
| 17 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import from_pretrained_keras
|
| 3 |
|
| 4 |
+
# Load the model from Hugging Face Hub
|
| 5 |
model = from_pretrained_keras("Bajiyo/Malayalam_transliteration")
|
| 6 |
|
| 7 |
+
# Function to preprocess text (replace with model-specific preprocessing if needed)
|
| 8 |
+
def preprocess_text(input_text):
|
| 9 |
+
# Assuming character-level model: convert text to sequence of integer indices
|
| 10 |
+
# Replace with your specific preprocessing steps based on the model's requirements
|
| 11 |
+
# You might need tokenization or other transformations
|
| 12 |
+
# ...
|
| 13 |
+
return preprocessed_text
|
| 14 |
+
|
| 15 |
def transliterate(input_text):
|
| 16 |
+
# Preprocess the input text
|
| 17 |
+
preprocessed_text = preprocess_text(input_text)
|
| 18 |
+
|
| 19 |
+
# Make predictions using the model
|
| 20 |
+
predictions = model.predict(preprocessed_text)
|
| 21 |
+
|
| 22 |
+
# Post-process the predictions if needed (replace with your logic)
|
| 23 |
+
output_text = predictions # Assuming model outputs transliteration directly
|
| 24 |
+
|
| 25 |
+
return output_text
|
| 26 |
|
| 27 |
textbox = gr.inputs.Textbox(label="Enter Malayalam Text")
|
| 28 |
|