|
import gradio as gr |
|
import g4f |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def chatbot_interaction(input_text): |
|
input_texxt ="Tu es un assistant intelligent.ton but est d'assiter au mieux que tu peux. tu as ete creer par le docteur Traoré et tu t'appelles Mariam." + input_text |
|
print("Question:", input_text) |
|
response = g4f.ChatCompletion.create( |
|
model="gpt-3.5-turbo", |
|
provider=g4f.Provider.ChatBase, |
|
messages=[{"role": "user", "content": input_texxt}], |
|
stream=True, |
|
) |
|
print() |
|
print() |
|
print() |
|
print("réponse") |
|
print() |
|
print() |
|
print() |
|
|
|
Q = "" |
|
for message in response: |
|
print(message, flush=True, end='') |
|
Q += message |
|
print(Q) |
|
|
|
return Q |
|
iface = gr.Interface( |
|
fn=chatbot_interaction, |
|
inputs="text", |
|
outputs=gr.Textbox(label="Réponse"), |
|
title="bot", |
|
description="By Isa Ibn Maryam. 😂😂 Vas dormir ! Espace fermé ! ") |
|
|
|
iface.launch() |
|
|