Spaces:
Sleeping
Sleeping
File size: 844 Bytes
7cd1bb6 1c461b7 c4a9cbc 7cd1bb6 1c461b7 7cd1bb6 4a57049 7cd1bb6 16bbc96 273f587 16bbc96 7cd1bb6 273f587 7cd1bb6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import google.generativeai as genai
import gradio as gr
api_key = "AIzaSyCmmus8HFPLXskU170_FR4j2CQeWZBKGMY"
model = genai.GenerativeModel('gemini-pro')
genai.configure(api_key = api_key )
def get_response(input_text):
try:
response = model.generate_content(f"I have an assignment which should seem like it is made by a {level}, it should have atleast {number_of_words} characters and should contain {how_many_errors} errors. The topic is '{topic}.'")
# response = model.generate_content(f"Give polarity score as a single number between 1 and 0 for the following sentence : {input_text}")
return response.text
except Exception as e:
return "Invalid Input"
iface = gr.Interface(
fn = get_response,
inputs = ["text" , "text" , "text" , "text"],
outputs = ["text"]
)
iface.launch() |