Spaces:
Build error
Build error
| # elif response[1] == "create_reminder": | |
| # # if values[4] == 'notime': | |
| # # return JsonResponse({ | |
| # # 'messages': 'At what time do you want me to remind you?', | |
| # # }) | |
| # # else: | |
| # return JsonResponse({ | |
| # 'messages': response[0], | |
| # 'action': response[1], | |
| # 'function': { | |
| # 'id': idval, | |
| # 'sound': 'General', | |
| # 'subTitle': 'Task', | |
| # 'type': 'Note', | |
| # 'title': values[0], | |
| # 'description': '', | |
| # 'time': values[1].upper(), | |
| # 'timestamp' : datetime.now().strftime("%d-%m-%Y %H:%M:%S.%f"), | |
| # 'enable': False, | |
| # 'report': [], | |
| # 'icon': 'https://firebasestorage.googleapis.com/v0/b/cosmo-f5007.appspot.com/o/categories%2FIcons%2Ftaskicon.svg?alt=media&token=56f3fc55-8eda-4463-bceb-7bf3198dff3c', | |
| # 'color': 'FFD700', | |
| # 'sharedToMe': [], | |
| # 'sharedByMe': [], | |
| # 'repeat': 'Once', | |
| # 'reminders': [{ | |
| # 'time': values[1].upper(), | |
| # 'enable': False, | |
| # 'repeat': 'Once', | |
| # 'title': values[0], | |
| # 'id': idval, | |
| # 'note': '', | |
| # 'dates': [], | |
| # }], | |
| # } | |
| # }) | |
| # elif response[1] == 'create_todo': | |
| # return JsonResponse({ | |
| # 'messages': response[0], | |
| # 'action': response[1], | |
| # 'function': { | |
| # 'name': 'defaulttodo', | |
| # 'id': idval, | |
| # 'subTasks': [{ | |
| # 'task':values[0].replace("create a todo", ""), | |
| # 'done': False | |
| # }], | |
| # 'shared': [], | |
| # 'sharedByMe': [], | |
| # }, | |
| # }) | |
| # elif response[1] == 'create_note': | |
| # return JsonResponse({ | |
| # 'messages': response[0], | |
| # 'action': response[1], | |
| # 'function': { | |
| # 'title': 'defaultnote', | |
| # 'id': idval, | |
| # 'type': 'Note', | |
| # 'description': values[0], | |
| # 'time': datetime.now().strftime("%d/%m/%Y"), | |
| # 'mainTime': datetime.now().strftime("%I:%M %p"), | |
| # 'complete': False, | |
| # 'shared': [], | |
| # 'sharedByMe': [], | |
| # } | |
| # }) | |
| import gradio as gr | |
| import requests | |
| import time | |
| import os | |
| import json | |
| import google.generativeai as genai | |
| genai.configure( | |
| api_key=os.environ['API_KEY']) | |
| model = genai.GenerativeModel( | |
| model_name='gemini-pro') | |
| def responsenew(data): | |
| prompt = data | |
| respo = model.generate_content( | |
| prompt, | |
| generation_config={ | |
| 'temperature': 0, | |
| 'max_output_tokens': 100 | |
| } | |
| ) | |
| return json.dumps(respo.text) | |
| gradio_interface = gr.Interface( | |
| fn = responsenew, | |
| inputs = "text", | |
| outputs = "text" | |
| ) | |
| gradio_interface.launch() | |
| # remind_val = ["create a reminder", "create reminder", "remind me"] | |
| # if remind_val in data: | |
| # return "Reminder created!" | |
| # else: | |
| # return bardChat(data) | |
| # with gr.Blocks() as demo: | |
| # chatbot = gr.Chatbot() | |
| # msg = gr.Textbox() | |
| # clear = gr.ClearButton([msg, chatbot]) | |
| # def respond(message, chat_history): | |
| # bot_message = responsenew(message) | |
| # chat_history.append((message, bot_message)) | |
| # time.sleep(2) | |
| # return "", chat_history | |
| # msg.submit(respond, [msg, chatbot], [msg, chatbot]) | |
| # if __name__ == "__main__": | |
| # demo.launch() |