Skip to content

Instantly share code, notes, and snippets.

View Ankur-singh's full-sized avatar
🎯
Focusing

Ankur Singh Ankur-singh

🎯
Focusing
View GitHub Profile
@Ankur-singh
Ankur-singh / flow.py
Created August 24, 2023 21:20
A basic working example demonstrating how to add a Gradio gateway to Jina `Flow`.
import gradio as gr
from pydantic import BaseModel
from jina import Flow, Executor, requests
from docarray import DocList, BaseDoc
from fastapi import FastAPI
from jina.serve.runtimes.gateway.http.fastapi import FastAPIBaseGateway
## helper function to convert pydantic model -> gradio interface
def generate_gradio_interface(model: BaseModel):
@Ankur-singh
Ankur-singh / .py
Created January 13, 2021 12:15
sqlite with pandas
import sqlite3
sqlite_file = 'my_first_db.sqlite' # name of the sqlite database file
table_name1 = 'my_table_1' # name of the table to be created
table_name2 = 'my_table_2' # name of the table to be created
new_field = 'my_1st_column' # name of the column
field_type = 'INTEGER' # column data type
# Connecting to the database file
conn = sqlite3.connect(sqlite_file)