Spaces:
Sleeping
Sleeping
File size: 4,092 Bytes
d0020e0 ec91473 b896b78 11c3841 b896b78 100826d b896b78 84ab7d1 100826d 84ab7d1 b896b78 01bef6f 100826d 3ae0e39 100826d e67766f 100826d 01bef6f 84ab7d1 100826d f03da32 f50380b f03da32 84ab7d1 b04bdf0 b896b78 f03da32 310bca6 f03da32 310bca6 f03da32 310bca6 f03da32 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# 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() |