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()