RomanGPT / app1.py
SunX45's picture
Rename app.py to app1.py
6dcbb41
raw
history blame contribute delete
679 Bytes
import gradio as gr
import tensorflow as tf
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.sequence import pad_sequences
model = load_model("romangpt.h5")
def generate_response(question):
input_data = [question]
input_sequence = pad_sequences(tokenizer.texts_to_sequences(input_data), maxlen=max_sequence_length-1)
response = model.predict(input_sequence)[0]
return response
iface = gr.Interface(
fn=generate_response,
inputs="text",
outputs="text",
live=True,
title="Π§Π°Ρ‚ с RomanGPT",
description="Π—Π°Π΄Π°ΠΉΡ‚Π΅ вопрос, ΠΈ RomanGPT сгСнСрируСт ΠΎΡ‚Π²Π΅Ρ‚.",
)
iface.launch()