Skip to content

Instantly share code, notes, and snippets.

import gradio as gr
import google.generativeai as genai
apikey = 'xxx' # Replace with your key
genai.configure(api_key=apikey)
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox()
clear = gr.ClearButton([msg, chatbot])
import gradio as gr
import google.generativeai as genai
apikey = 'xxx' # Replace with your key
genai.configure(api_key=apikey)
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox()
import gradio as gr
from openai import OpenAI
import docx2txt
from langchain.document_loaders import TextLoader
from langchain.vectorstores import FAISS
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.document_loaders import PyPDFLoader
from langchain.document_loaders import Docx2txtLoader
import os
from langchain.embeddings import OpenAIEmbeddings
import gradio as gr
from openai import OpenAI
import docx2txt
import PyPDF2
api_key = "sk-" # Replace with your key
def read_text_from_file(file_path):
# Check the file type and read accordingly
import gradio as gr
from openai import OpenAI
api_key = "sk-" # Replace with your key
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox()
clear = gr.Button("Clear")
filename = gr.File()
import gradio as gr
from openai import OpenAI
api_key = "sk-" # Replace with your key
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox()
clear = gr.Button("Clear")
import gradio as gr
from openai import OpenAI
api_key = "sk-" # Replace with your key
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox()
clear = gr.ClearButton([msg, chatbot])
import gradio as gr
from openai import OpenAI
import docx2txt
import PyPDF2
api_key = "sk-" # Replace with your key
def read_text_from_file(file_path):
# Check the file type and read accordingly
import requests
from bs4 import BeautifulSoup
import pandas as pd
def matchbymatch(id):
urlformat = 'https://stats.espncricinfo.com/ci/engine/player/{}.html?class=2;template=results;type=allround;view=match'.format(id)
page = requests.get(urlformat)
bs = BeautifulSoup(page.content, 'lxml')
rows = bs.find_all('tr',class_='data1')
data = []
import os
from io import BytesIO
import tarfile
import tempfile
from six.moves import urllib
from matplotlib import gridspec
from matplotlib import pyplot as plt
import numpy as np
from PIL import Image