Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
import tensorflow as tf
|
3 |
from tensorflow import keras
|
4 |
import gradio as gr
|
@@ -11,14 +12,16 @@ model_path = 'doctor_ai_model.h5' # Change this to your actual model path
|
|
11 |
model = keras.models.load_model(model_path)
|
12 |
|
13 |
def chatbot(input_text):
|
14 |
-
#
|
15 |
-
#
|
16 |
-
# For example:
|
17 |
# input_tensor = your_tokenizer.texts_to_sequences([input_text])
|
18 |
# input_tensor = tf.keras.preprocessing.sequence.pad_sequences(input_tensor)
|
19 |
|
20 |
-
# Assuming your model
|
21 |
-
|
|
|
|
|
|
|
22 |
|
23 |
return response[0] # Adjust based on your model output
|
24 |
|
|
|
1 |
import os
|
2 |
+
import numpy as np
|
3 |
import tensorflow as tf
|
4 |
from tensorflow import keras
|
5 |
import gradio as gr
|
|
|
12 |
model = keras.models.load_model(model_path)
|
13 |
|
14 |
def chatbot(input_text):
|
15 |
+
# Preprocess input_text if necessary
|
16 |
+
# For example, you may need to tokenize the input or convert it to a sequence
|
|
|
17 |
# input_tensor = your_tokenizer.texts_to_sequences([input_text])
|
18 |
# input_tensor = tf.keras.preprocessing.sequence.pad_sequences(input_tensor)
|
19 |
|
20 |
+
# Assuming your model accepts a 2D array (batch size, features)
|
21 |
+
input_tensor = np.array([input_text]) # Convert list to numpy array
|
22 |
+
|
23 |
+
# Make a prediction
|
24 |
+
response = model.predict(input_tensor) # Adjust based on your model's expected input
|
25 |
|
26 |
return response[0] # Adjust based on your model output
|
27 |
|