I want to read vcf file using file uploader

import io
import os
import pandas as pd
import streamlit as st

if ifile:

def read_vcf(path):
    with open(ifile, 'r') as f:
        lines = [l for l in f if not l.startswith('##')]
    return pd.read_csv(
        dtype={'#CHROM': str, 'POS': int, 'ID': str, 'REF': str, 'ALT': str,
               'QUAL': str, 'FILTER': str, 'INFO': str},
    ).rename(columns={'#CHROM': 'CHROM'})


This code shows, TypeError: expected str, bytes or os.PathLike object, not UploadedFile

Hi @Manjeet_Yadav, welcome to the community! :wave: :partying_face:

I would suggest reading through the examples section of the st.file_uploader docs to understand how to read files into various formats:

e.g. To convert to a string based IO:
stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))